Method and system for building a streaming model

ABSTRACT

A method of constructing a plurality of downloadable files from an application file and a plurality of transcripts. The application file stores data blocks and implements an application. Each of the transcripts stores at least one order in which at least a portion of the data blocks of the application file were accessed by the application when executed previously. The transcripts are combined into a combined transcript storing at least one combined order comprising a combined portion of the data blocks. The data blocks of the combined portion are arranged in a data structure having an origin. A first set of data blocks within a predetermined distance from the origin is stored in at least one initial execution file. A second set of data blocks outside the predetermined distance from the origin is stored in downloadable sequence files.

CROSS REFERENCE TO RELATED APPLICATION(S)

This application claims the benefit of U.S. Provisional Application No.61/361,373, filed Jul. 2, 2010, which is incorporated herein byreference in its entirety.

BACKGROUND OF THE INVENTION

Field of the Invention

The present invention is directed generally to methods and systems forprofiling access to a file that implements an application.

Description of the Related Art

A virtual application is a virtual machine image pre-configured with allof the files, registry data, settings, components, runtimes, and otherdependencies required for a specific application to execute immediatelyand without installation on a host computing device. The virtualapplication is partially isolated from other applications implemented ona host computing device and partially isolated from an underlying hostoperating system installed and executing on the host computing device.The virtual application is encapsulated from the host operating systemby a virtual runtime environment, which includes a virtual operatingsystem, that receives operations performed by the virtualizedapplication and redirects them to one or more virtualized locations(e.g., a virtual filesystem, virtual registry, and the like).

Thus, the virtual application may be conceptualized as including twocomponents: a virtualization runtime and a virtual applicationconfiguration. The virtualization runtime implements the virtual runtimeenvironment, which implements various operating system applicationprogramming interfaces (“APIs”) in such a way that allows the executingvirtual application to access and interact with items that may not bepresent on the host computer. The virtual application configurationincludes data necessary to implement the virtual application within thevirtualization runtime.

The virtual application is stored in and implemented by one or more datafiles and/or executable files. Depending upon the implementationdetails, the one or more data files and/or executable files storing andimplementing the virtual application may include blocks of datacorresponding to each application file of a natively installed versionof the application. Herein, these blocks of data will be referred to as“virtual application files.” The one or more data files and/orexecutable files storing and implementing the virtual application alsoinclude configuration information.

The data files and/or executable files are configured to execute withina virtual runtime environment that is provided at least in part by thevirtual operating system. When the virtual application is executedwithin the virtual runtime engine, the configuration information is usedto configure the virtual operating system to execute the virtualapplication. For example, the configuration information may containinformation related to the virtual application files, virtual registryentries, environment variables, services, and the like. The virtualoperating system is configured to communicate with the host operatingsystem as required to execute the virtual application on the hostcomputing device.

To download and execute a virtual application, a user must either use aspecialized streaming protocol or download the entire virtualizedapplication file before executing the application. Therefore, a needexists for a method and system configured to download and execute avirtualized application file without first downloading the entire fileor using a specialized streaming protocol. The virtual application canbe executed using less than the entire virtualized application fileprovided the executing virtual application does not request access to aportion of the file that has not been downloaded. Therefore, a needexists for a method or system that determines in which order the virtualapplication will request access to portions of the virtualizedapplication file. A need also exists for systems and methods formanaging the download and execution of a virtual application by avirtual runtime engine. The present application provides these and otheradvantages as will be apparent from the following detailed descriptionand accompanying figures.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWING(S)

FIG. 1 is a diagram of a system for transferring a virtualizedapplication file from a server computing device to a client computingdevice over a network.

FIG. 2 is an illustration of a conceptualization of software componentsstored in a system memory of the client computing device of FIG. 1, thesoftware components including a Client Application and a SandboxManager.

FIG. 3 is an illustration of a conceptualization of software componentsstored in memory and executing on the server computing device of FIG. 1,the software components include a virtualized application file, and avirtual application authoring tool.

FIG. 4 is a flow diagram of a profiling process that records accessesmade to the xlayer file by a virtual application as it executes.

FIG. 5 is a flow diagram of a method performed by a directing processimplemented by the Sandbox Manager.

FIG. 6 is a block diagram illustrating transcripts, a combinedtranscript created based on the transcripts, and a directed graphstructure constructed based on the combined transcript.

FIG. 7 is a flow diagram of a method that may be performed by theSandbox Manager and/or a Client Application.

FIG. 8 is a diagram of a streaming model.

FIG. 9 is a flow diagram of a method of building a streaming model for aparticular application and distributing that streaming model acrossmultiple server computing devices.

FIG. 10 is an illustration of a ModelRequest table.

FIG. 11 is an illustration of an application library database thatincludes an application table, an application version table, an xlayertable, and an xlayer version table.

FIG. 12 is an illustration of a data schema that includes anXStreamModel table, an XFile table, a ServerXFile table, and a Servertable.

FIG. 13 is a diagram illustrating exemplary communications between acomputing device operated by an application publisher or developer(labeled “Client (Publisher)”), the server computing device of FIG. 1(labeled “Public Spoon Serve”), and the model building server of FIG. 1(labeled “Build Server”).

FIG. 14 is an illustration of a block of memory shared by the SandboxManager and the virtual runtime engine during directed execution of avirtual application.

FIG. 15 is an illustration of data structures uses to implement dynamicpopulation of an xlayer file on the client computing device.

FIG. 16 is an exemplary xsequence file format.

FIG. 17 is an exemplary xblock format.

FIG. 18 is a flow diagram of a method that may be performed by theSandbox Manager.

FIG. 19 is a block diagram of a streaming model.

FIG. 20 is a flow diagram of a method of building the streaming model ofFIG. 19.

FIG. 21 is a flow diagram of a method of distributing streaming models.

FIG. 22 is a flow diagram of a method of locating a streaming model.

FIG. 23 is a flow diagram of a method of constructing the streamingmodel of FIG. 19.

FIG. 24 is a block diagram of a state object.

FIG. 25 is a block diagram of a transition data structure.

FIG. 26 is a flow diagram of a method of encoding pages of a directedgraph structure into xsequence files.

FIG. 27 is a flow diagram of a method of starting a virtual applicationin a directed fashion.

FIG. 28 is a diagram of a hardware environment and an operatingenvironment in which one or more of the computing devices of the systemof FIG. 1 may be implemented.

DETAILED DESCRIPTION OF THE INVENTION

FIG. 1 illustrates a system 5 for downloading or otherwise transferringa virtualized application file stored on a server computing device 7 toa client computing device 9 over a network 10 (e.g., the Internet, aWAN, a LAN, a combination thereof, and the like). One or more additionalcomputing devices, such as a second server computing device 6 and acomputing device 11, may also be coupled to the network 10. In theembodiment illustrated, the server computing device 7 is implemented asa web server. The server computing device 7 may be connected to one ormore additional computing devices. In the embodiment illustrated, theserver computing device 7 is connected to a model building server 8.Depending on the implementation details, the server computing device 7may be connected to the model building server 8 by the network 10.

A diagram of hardware and an operating environment in conjunction withwhich implementations of the server computing device 7, the modelbuilding server 8, the client computing device 9, the computing device11, and the network 10 may be practiced is provided in FIG. 28 anddescribed below.

FIG. 2 illustrates a system memory 22A of the client computing device 9(illustrated in FIG. 1) storing a conventional operating system 35A,that like most operating systems, includes a filesystem 126A, a registry128A, and a process environment and threading subsystems component 130A.A Client Application 132 (e.g., a web browser application) and a SandboxManager 134 are also stored in the system memory 22A of the clientcomputing device 9 (illustrated in FIG. 1). Optionally, the ClientApplication 132 may include a plug-in 136 or similar application. In theembodiment illustrated, the Client Application 132 communicates with theSandbox Manager 134 over a communication link 138 that may beimplemented as a Transmission Control Protocol (“TCP”) connection usingTCP protocol. Each virtualized application file being transferred and/orexecuted may be identified by a unique session identifier (“SessionId”).A cache 139 may be stored on the filesystem 126A for use by the SandboxManager 134. The Sandbox Manager 134 and Client Application 132 aredescribed in detail in U.S. patent application Ser. No. 12/695,107,filed on Jan. 27, 2010, and titled SYSTEM FOR DOWNLOADING AND EXECUTINGA VIRTUAL APPLICATION, which is incorporated herein by reference.

As explained above, a virtualized application file 140 is transferred tothe client computing device 9 from the server computing device 7. Thevirtualized application file 140 is illustrated in dashed lines toindicate that the virtualized application file 140 is stored in thecache 139 during and after the download. However, before the downloadbegins, the virtualized application file 140 is not stored in the cache139. As will be explained below, the virtualized application file 140may be an executable file or a file configured to execute within avirtualized environment provided by a virtual machine (or virtualruntime engine).

The system memory 22A stores one or more files implementing one or morevirtual machines (or virtual runtime engines). By way of a non-limitingexample, the system memory 22A may include a plurality of virtualmachine executable files 137 that when executed, each implement adifferent virtual machine. For example, each of the virtual machineexecutable files 137 may implement a different version of the samevirtual machine. The virtual machine executable files 137 may beexecuted individually. When executed, a virtual machine executable fileimplements a virtualized environment. Execution of a virtual machineexecutable file may be initiated by the Sandbox Manager 134 using acommand including a parameter (e.g., a file path) identifying avirtualized application file to execute. In response to receiving theparameter, the virtual machine executable file executes the identifiedvirtualized application file inside the virtualized environmentimplemented by the virtual machine executable file. FIG. 2 illustrates avirtual application 110 (implemented by the virtualized application file140) being executed by a virtual runtime engine 131. The virtual runtimeengine may execute within an operating system shell process. Optionally,the virtual machine executable files 137 may be stored in the cache 139.

The Sandbox Manager 134 and the virtual runtime engine 131 may both haveread/write access to a block of shared memory 133 that may be used tosend settings and state information between the Sandbox Manager 134 andthe virtual runtime engine 131.

The virtualized application file 140 includes a version identifier thatmay be used by the Sandbox Manager 134 to select which of the virtualmachine executable files 137 is configured to execute the virtualizedapplication file 140.

FIG. 3 illustrates a system memory 22B of the server computing device 7(illustrated in FIG. 1). The system memory 22B stores a conventionalhost operating system 35B, that like most operating systems, includes ahost filesystem 126B, a host registry 128B, and a process environmentand threading subsystems component 130B. FIG. 3 also illustrates anexecutable virtualized application file 140 stored in the system memory22B and configured to execute on the host operating system 35A (see FIG.2) of the client computing device 9 (illustrated in FIG. 1), optionallywithin a virtual machine implemented by a separate virtual machineexecutable file, without having been installed on the host operatingsystem 35B. The virtualized application file 140 may be configured toexecute on the operating system 35B of the server computing device 7(illustrated in FIG. 1), optionally within a virtual machine (or virtualruntime engine) implemented by a separate virtual machine executablefile, but this is not a requirement.

In the embodiment illustrated, the system memory 22B stores web servercomponents 142 configured to implement a web server. The web servercomponents 142 may be configured to provide a web page having one ormore links to virtualized application files using standard HypertextTransfer Protocol (“HTTP”) protocol. By way of non-limiting examples,the web server components may include Internet Information Services(“IIS”) provided by Microsoft Corporation, Apache, and the like. Whileillustrated as being outside the filesystem 126B, those of ordinaryskill in the art appreciate that the virtualized application file 140and the web server components 142 may be conceptualized as being withinthe filesystem 126B.

The virtualized application file 140 may include components necessary toimplement a virtual runtime environment including a virtual operatingsystem 120 configured to execute in the operating system 35A (see FIG.2) of the client computing device 9 (illustrated in FIG. 1).Alternatively, the virtual runtime environment may be implemented by oneof the virtual machine executable files 137 (see FIG. 2). Thevirtualized application file 140 includes components necessary toimplement the virtual application 110 configured to execute in thevirtual runtime environment (provided by the virtual runtime engineillustrated in FIG. 2). In particular embodiments, a single virtualizedapplication file is used to implement both the virtual operating system120 and the virtual application 110. However, those of ordinary skill inthe art appreciate that more than one virtualized application file maybe used to implement the virtual operating system 120 and the virtualapplication 110. For example, the components implementing the virtualruntime environment may be stored in one of the virtual machineexecutable files 137 (see FIG. 2) and the components implementing thevirtual application 110 may be stored in the virtualized applicationfile 140. Further, one or more of the files used to implement thevirtual application 110 may be other than an executable file having the“exe” file extension.

The virtual operating system 120 includes a virtual filesystem 150, avirtual registry 152, and a virtual process environment and threadingsubsystems component 154. The virtual application 110 interacts with thevirtual filesystem 150, virtual registry 152, and virtual processenvironment and threading subsystems component 154, instead ofinteracting directly with the host filesystem 126A, the host registry128A, and the process environment and threading subsystems component130A of the host operating system 35A illustrated in FIG. 2. The virtualoperating system 120 is configured to communicate with the hostoperating system 35A illustrated in FIG. 2 as required to execute thevirtual application 110.

The virtual application 110 executes inside a virtual runtimeenvironment provided at least in part by the virtual operating system120. Some virtual applications require one or more additional runtimeenvironments to execute. For example, to execute a Flash application,the Flash runtime engine must also be installed. Therefore, tovirtualize a Flash application, both the Flash application and Flashruntime engine must be included in the virtualized application file 140and configured to execute in the portions of the virtual runtimeenvironment provided by the virtual operating system 120. Collectively,all runtime components necessary to execute the virtual application 110will be referred to as a virtual runtime engine. However, those ofordinary skill in the art appreciate that the virtual runtime engine mayinclude only the virtual operating system 120 and components of otheradditional runtime engines (e.g., the Flash runtime engine) required toexecute the virtual application 110 may be loaded separately by thevirtual operating system 120. When executed, the virtual runtime enginegenerates, at least in part, the virtual runtime environment in whichthe virtual application 110 executes.

Referring to FIG. 2, a natively installed version of an application isconfigured to execute within a runtime environment provided at least inpart by the host operating system 35A. Typically, to execute within theruntime environment provided at least in part by the host operatingsystem 35A, a natively installed version of an application modifies theconfiguration and settings of the host operating system 35A. Forexample, the natively installed version may install dynamic linklibraries or change registry settings of the host operating system 35A.In contrast, a virtual version of the same application may be executedon the host operating system 35A without installation on the hostoperating system 35A. Thus, the virtual application 110 does not modifythe configuration or settings of the host operating system 35A. Forexample, to execute the virtual application 110, dynamic link libraries(‘dlls’), data files, registry settings, environment variables, and thelike need not be modified on to the host operating system 35A.

The virtualized application file 140 includes virtualized applicationfiles 123A-123C corresponding to application files 111A-111C of anatively installed version of the same application. The virtualizedapplication files 123A-123C are stored as blocks of data inside aconfiguration data block 121. During execution, the virtualizedapplication files 123A-123C are accessed via the virtual filesystem 150.The virtualized application files 123A-123C include one or more startupexecutables. The virtualized application file 140 identifies one or morestartup executables that are executed when the virtual application 110is first executed. The startup executables may be identified in theconfiguration data block 121.

When the virtualized application file 140 is executed, the configurationdata block 121 is used to configure the virtual operating system 120 toexecute the virtual application. For example, the configuration datablock 121 may contain configuration information related to the files inthe virtual filesystem 150 (e.g., the virtualized application files123A-123C), entries in the virtual registry 152, environment variables,services, and the like. The configuration data block 121 may alsoinclude basic application metadata and settings such as the applicationname, application version, and sandbox location. Further, theconfiguration data block 121 may provide isolation information to thevirtual operating system 120. This information indicates whichvirtualized application files 123A-123C, virtual registry keys, virtualregistry values, environment variables, and services are to be isolatedfrom the host operating system 35A.

The configuration data block 121 may also include one or more virtuallayers. Each virtual layer may identify files, registry entries,environment variables, and services. As the virtual layers are read, thecorresponding files, registry entries, environment variables, andservices are added to appropriate runtime data-structures. If thevirtualized application file 140 is configured to execute on more thanone host operating system, the configuration data block 121 may includea virtual layer for each operating system. In such an embodiment, eachvirtual layer includes information necessary to configure the virtualruntime environment to execute on a particular operating system.Further, the configuration data block 121 may include a virtual layerthat includes configuration information common to the other virtuallayers (e.g., a “default” virtual layer).

To execute the virtual application 110, an initialization process isfirst performed. During this process, the virtual operation system 120is launched and configured by the configuration data block 121. Acomponent of the virtual runtime engine 131 referred to as a “reader”(not shown) reads data stored in the configuration data block 121 anduses that data to configure the virtual runtime environment. Forexample, the reader reads the virtual layer for the host operatingsystem 35A and any other applicable virtual layers and uses theinformation read to configure the virtual operation system 120 (and insome implementations, other components of the virtual runtimeenvironment) to execute the virtual application 110 on the hostoperating system 35A. The virtual filesystem 150 may be configured tomirror a host filesystem configured to execute a natively installedversion of the application. Similarly, the virtual registry 152 may beconfigured to mirror a host registry configured to execute a nativelyinstalled version of the application.

After the initialization process has completed, the appropriate startupexecutable(s) is/are launched inside the virtual operating system 120.The virtual operating system 120 intercepts calls to the host operatingsystem 35A (see FIG. 2) and routes them to corresponding components ofthe virtual operating system 120. For example, when the virtualapplication 110 requests to access an application file using a path of anatively installed version of the application, the virtual operatingsystem 120 intercepts the request and routes the request to one of thevirtualized application files 123A-123C corresponding to the applicationfile requested. The virtual operating system 120 may also route somerequests and actions to the host operating system 35A (see FIG. 2) forprocessing.

The virtualized application file 140 is read-only and when executed,cannot be modified by the virtual application 110 or components of thevirtual runtime engine 131 (see FIG. 2). Therefore, modifications to thedata stored in the configuration data block 121 (e.g., modifications tothe virtualized application files 123A-123C, modifications to theregistry keys of the virtual registry 152, and the like) are written toa readable and writable memory location referred to herein as a sandbox124. The sandbox 124 is a location on the host filesystem 126A, anetwork share, a removable storage device, and the like whereat filesmay be created, modified, and deleted by the virtual application 110 atruntime. For example, when the virtual operating system 120 needs tocreate, modify, or delete a virtualized application file, the virtualoperating system does so in the sandbox 124. Similarly, if the virtualapplication 110 modifies a virtual registry value, the virtual registryvalue is changed in the sandbox 124. The virtual operating system 120may also route some requests and actions to the host operating system35A for processing.

U.S. patent application Ser. No. 12/188,155, filed on Aug. 7, 2008, U.S.patent application Ser. No. 12/188,161 filed on Aug. 7, 2008, and U.S.patent application Ser. No. 12/685,576 filed on Jan. 11, 2010, all ofwhich are incorporated herein by reference in their entireties, disclosesystems that may be used to create and configure the virtualizedapplication file 140. As described in greater detail in U.S. patentapplication Ser. Nos. 12/188,155, 12/188,161, and 12/685,576, thevirtualized application file 140 may be created by a virtual applicationexecutable constructor or authoring tool 170 using an applicationtemplate that includes copies of files, such as a configuration file202, application files 111A-111C, and the like, used to configure thevirtualized application file 140. However, the template is not arequirement. Instead, to build the virtualized application file 140, theauthoring tool 170 needs only the configuration file 202 and copies ofany applications files 111A-111C necessary for a natively installedversion of the application to execute. The applications files 111A-111C,and the configuration file 202 are referred to collectively as anapplication configuration 171.

The authoring tool 170 combines the application configuration 171 andthe components of the virtual runtime engine (e.g., the virtualoperating system 120) into the executable virtualized application file140. Sometimes multiple virtual applications share a common set ofvirtual machine configuration settings or virtual runtime enginecomponents. By way of a non-limiting example, multiple Flashapplications may be configured to be executed by the same Flash runtimeengine. Further, system administrators may want to share a common set ofconfiguration options (e.g., browser bookmarks, application settings,etc.) across a department or enterprise. These settings may be stored ina file, referred to as an xlayer file 300, and incorporated into one ormore virtual application files at runtime by the virtual runtime engine131. Depending upon the implementation details, the authoring tool 170may be used to create the xlayer file 300.

The xlayer file 300 cannot be executed directly from the host operatingsystem 35A and instead requires the virtual runtime environment suppliedat least in part by the virtual operating system 120. Like theconfiguration data block 121, the xlayer file 300 may be read by thereader of the virtual runtime engine at runtime. The information storedwithin the xlayer file 300 may be made available to a virtualapplication (e.g., the virtual application 110) via the virtualfilesystem 150 and virtual registry 152 of the virtual operating system120 at runtime. By way of a non-limiting example, the configuration datablock 121 may specify a location on the host filesystem 126A whereat thevirtual runtime engine is configured to look for xlayer files. If anxlayer file is located in the specified location, the xlayer file 300may be read automatically by the reader of the virtual runtimeenvironment. Alternatively, the virtual runtime engine 131 may beconfigured to look for xlayer files in a particular location each timethe virtual application 110 is executed.

The xlayer file 300 may be shared between users and used to supplyvirtual machine settings to multiple virtual applications. The xlayerfile 300 may include all virtual registry and virtual filesysteminformation associated with a particular software component (e.g., avirtual runtime engine component), allowing the component to be fullyinstalled in the virtual runtime environment. The xlayer file 300 mayinclude all of the application data required to implement the virtualapplication 110 when executed by the virtual runtime engine 131. Thexlayer file 300 may be implemented as a binary file. The data in thexlayer file 300 may be organized in one or more virtual layerssubstantially similar to the virtual layers of the configuration datablock 121 described above.

As is apparent to those of ordinary skill in the art, the number offiles and registry keys needed to implement a virtual application (suchas the virtual application 110) and/or a component encoded in the xlayerfile 300 can be very large. For example, it is not uncommon for thenumber of files and registry keys needed to implement a virtualapplication to total in the tens of thousands. Therefore, theperformance characteristics of the configuration data block 121 and thexlayer file 300 can affect the performance of the virtual application110 significantly. In other words, the performance characteristics ofthe configuration data block 121 and/or the xlayer file 300 can increaseor decrease the startup time for the virtual application 110.

Further, the size of the xlayer file 300 may affect an amount of timerequired to access data stored by the xlayer file 300, which may affectthe performance of the virtual application 110. The size of the xlayerfile 300 also affects an amount of time required to download (orotherwise communicate) the xlayer file 300 between computing devices(e.g., the computing devices 7 and 9 illustrated in FIG. 1) and across anetwork (e.g., the network 10 illustrated in FIG. 1).

As is apparent to those of ordinary skill in the art, the configurationdata block 121 and the xlayer file 300 store similar data and therefore,can be formatted in accordance with a common format. U.S. patentapplication Ser. No. 12/697,029, filed on Mar. 31, 2010, entitled Methodand System for Improving Startup Performance and Interoperability of aVirtual Application, which is incorporated herein by reference in itsentirety, describes a file format that may be used to configure theconfiguration data block 121 portion of the executable virtualizedapplication file 140 and/or the xlayer file 300.

Xsequence Files

Referring to FIG. 3, as mentioned above, the size of the xlayer file mayaffect the amount of time required to access data stored by the xlayerfile 300, which may affect the performance of the virtual application110. The size of the xlayer file 300 also affects an amount of timerequired to download (or otherwise communicate) the xlayer file 300between computing devices (e.g., from the server computing device 7 tothe client computing device 9 illustrated in FIG. 1) and across anetwork (e.g., the network 10 illustrated in FIG. 1).

Applications often store large amounts of data in a single file storedon a hard disk. For example, the virtual application 110 may be executedusing one or more xlayer files (e.g., the xlayer file 300). Unlikestreaming media where a file is used in a linear fashion, someapplications (e.g., the virtual application 110) require random accessto chunks of data, referred to herein as “pages.” Thus, the pagesrequired by the end user (or the application) are retrieved from a filein a non-sequential fashion. In other words, the pages are accessed innon-predetermined sequences that may include some randomness and may bedifficult to predict. Depending upon the implementation details, pagesmay have a predetermined size (e.g., 4 kilobytes, 10 kilobytes, etc.).Alternatively, pages may have non-uniform sizes.

If during execution, an application suddenly requires access to a pagethat has not yet been downloaded, a delay must be introduced to downloadthe page. Alternatively, execution of the application may end. To avoidthis problem, when the xlayer file 300 is hosted on a web server (e.g.,a web server implemented by the web server components 142 of the servercomputing device 7 illustrated in FIG. 1), the user may download theentire xlayer file 300 to the client computing device 9 illustrated inFIG. 1 before the virtual application 110 can be executed on the clientcomputing device 9 illustrated in FIG. 1. The delay introduced by thedownload process greatly impacts the user experience. However, delaysmay be avoided by preemptively downloading pages before they are neededbut, as mentioned above, preemptive downloading is difficult becausewhich pages will be accessed by the application and when may bedifficult to predict. Thus, it is desirable to download the pages in anorder that is consistent with an order in which the application (whenoperated by a user) will request access to the pages.

If there is a predictable pattern in the order in which the pages arerequested by the application, the pages can be ordered and encoded intofiles that model this pattern. In this manner, the most commonlyaccessed pages or page sequences may be downloaded first. This improvesaccess time and transmission efficiency. Depending upon theimplementation details, this ordering and encoding allows the pages tobe distributed using standard Hypertext Transfer Protocol (“HTTP”),which is a conventional download technology, and does not require theuse of specialized streaming protocols. By way of additionalnon-limiting examples, the pages to be distributed using otherconventional download protocols, including File Transfer Protocol(“FTP”), Server Message Block Protocol (“SMB”), and the like.

For example, pages stored in a large single xlayer file (e.g., thexlayer file 300) can be reordered and divided into a plurality ofsmaller files (referred to herein as “xsequence files”) encoded using apredetermined file format (referred to herein as “xsequence fileformat,” which is described in detail below). The xsequence file formatis configured to store permutations of at least a portion of the pagesstored in a larger file (e.g., the xlayer file 300) and enablesstreaming distribution of the larger xlayer file. As mentioned above,the smaller xsequence files may be streamed over the Internet usingconventional download methods thereby transferring the data of thexlayer file between different computing devices. Thus, the virtualapplication 110 may be launched by the client computing device 9 fromthe web without first downloading the entire xlayer file 300. This maygreatly decrease startup latency. The remaining portions of the xlayerfile may be downloaded subsequently while the user interacts with theexecuting virtual application 110.

For ease of illustration, the file from which one or more xsequencefiles are created will be referred to as an “original file.” While theoriginal file may be an xlayer file (e.g., the xlayer file 300) havingone or more of the file format(s) described in U.S. patent applicationSer. No. 12/697,029, it is apparent to those of ordinary skill in theart that the original file may have a format other than the fileformat(s) described in U.S. patent application Ser. No. 12/697,029. Forexample, the original file may be an alternate encoding of a virtualmachine or virtual application, a data file, an xml file, and the like.For ease of illustration, the original file is described below asimplementing the virtual application 110. However, as is apparent tothose of ordinary skill in the art, the original file may implementother applications, including applications requiring installation on theclient computing device 9 (see FIG. 1).

Profiling

Profiling generally refers to a method of analyzing an application(e.g., the virtual application 110) to determine usage statistics. Aprofile or transcript of the application contains information about asingle execution of the application such as the order of the pageaccess, and the time spent in each transition between pages. Thetranscript may be stored in a transcript file 125 (see FIG. 2). Multipletranscript files may be combined or merged to generate a streaming model122 (illustrated in FIG. 19 and described below).

An application (e.g., the virtual application 110) may implement one ormore processes that are selectively executed as the applicationexecutes. As the virtual application 110 executes, it implements one ormore such processes that each access the original file (e.g., the xlayerfile 300) to obtain information about the virtual application 110. Thisinformation includes, but is not limited to, virtual environmentsettings, virtual filesystem information, virtual registry information,and the like. This information resides in various locations within theoriginal file (e.g., the xlayer file 300). Threads and processes spawnedby the virtual application 110 as it executes may be treated as separateinstances and merged together in the same transcript file in a mannersimilar to that used to merge multiple transcript files together(discussed below).

A profiling process 700 described below may be used to determine anorder in which blocks of data (pages) stored in a file are accessed byan executing application. For ease of illustration, the profilingprocess 700 will be described as being performed with the virtualapplication 110. However, as is apparent to those of ordinary skill inthe art, the profiling process 700 may be performed with other types ofapplications, including applications requiring installation on theclient computing device 9 (see FIG. 1).

The profiling process 700 profiles usage of the virtual application 110to generate transcript files (such as the transcript file 125illustrated in FIG. 2) that are used to generate a streaming model(e.g., the streaming model 122 illustrated in FIG. 19) that specifies anorder in which pages are downloaded from the server computing device 7to the client computing device 9. While the xlayer file 300 may bethought of as generally opaque, data is written sequentially within thexlayer file 300. Furthermore, virtual files within a specific virtualdirectory are generally written sequentially, one after the other. Thesame can be said for virtual registry keys and values. Therefore,profiling access to the xlayer file 300 is substantially similar toprofiling access to the underlying files and registry entries of anatively installed application.

As mentioned above, the Sandbox Manager 134 (see FIG. 2) may execute thevirtual application 110 (inside the virtual runtime engine 131). As willbe explained below, the Sandbox Manager 134 may implement a directingprocess (see FIG. 2) configured to collect profile information that maybe used to profile the virtual application's access to the underlyingoriginal file (e.g., the xlayer file 300). Such profile information maybe used to perform statistical analysis of a software application (e.g.,the virtual application 110) to create a model of its data consumption.The profile information may also be used to make runtime adjustments inreal-time to the data-delivery schedule (described in the ModelingSubsection below). The data-delivery schedule being the order in whichdata or pages are organized in the xsequence files and/or the order inwhich the xsequence files are delivered to the client computing device9.

The information stored in the transcript files (generated by theprofiling process 700) is then used to divide the original file intopages that are loaded onto the server computing device 7 for download tothe client computing device 9. The server computing device 7 streams thexsequence files to the client computing device 9 through the ClientApplication 132 and the Sandbox Manager that together download andexecute the pages.

The profiling process 700 described herein may be used to performaccurate and low-overhead profiling of a virtual application's access toan underlying xlayer file. Depending upon the implementation details,the profiling process 700 may include the use of per-thread datastructures and named-pipes to communicate to the directing process 129that by the executing virtual application has requested access to rawblock level data (stored in the original file, e.g., the xlayer file300). The term “per-thread data structure” refers to a data structurecorresponding to a single thread. Thus, a separate per-thread datastructure may be created for each thread used by an application (e.g.,the virtual application 110). A ThreadDiscriminate value is sent to theSandbox Manager 134 by the virtual runtime engine 131 when a thread iscreated. The ThreadDiscriminate value is an entry point discriminatorfor the thread accessing the xlayer file. An example method ofgenerating the ThreadDiscriminate value is described below.

The profiling process 700 is performed using a PseudoPid value and aPseudoTid value. The PseudoPid value and the PseudoTid value aredetermined by the virtual runtime engine 131.

The PseudoPid value is a unique process identifier of the applicationprocess accessing the original file (e.g., the xlayer file 300). Becauseoperating system allocated process identifiers (“Pid” values) can berecycled and reused, a unique identifier (the PseudoPid value) isgenerated for each process. The PseudoPid value may be generated byperforming a hash function using the operating system allocated Pidvalue and the current system time as input parameters. For example, thefollowing pseudo code may be used to generate the PseudoPid value:PseudoPid=Hash(GetCurrentProcessId( ),GetSystemTime( )).

The hash function performed may be a 32-bit “good” hash function. Thoseof ordinary skill in the art are familiar with good hash functions.Therefore, such functions will not be described herein.

Furthermore, because operating system allocated thread identifiers(“Tid” values) can be recycled and reused, a unique identifier (thePseudoTid value) is generated for each thread. The PseudoTid value maybe generated by performing a hash function using the operating systemallocated Tid value and the current system time as input parameters. Forexample, the following pseudo code may be used to generate the PseudoTidvalue:PseudoTid=Hash(GetCurrentThreadId( ),GetSystemTime( ))The hash function performed may be a 32-bit “good” hash function.

Thus, there may be three different scopes for the profiling process 700:Session, Process, and Thread. Session scope includes the profilingcontext of a single execution of the virtual application 110. As isapparent to those of ordinary skill in the art, during execution, thevirtual application 110 may include multiple processes and multiplethreads.

Process scope refers to the lifetime of a single process instance (givena unique PseudoPid value, described below) within a session. If two ormore virtualized application files are launched more than once, aseparate process for each launched file (each having a differentPseudoPid value) and a separate process contexts for each launched fileare created (or recorded) within a transcript. If the same virtualizedapplication file is launched more than once, execution statisticsrecorded for each process can be aggregated using the name of thevirtualized application file (or other identifier) to identify executionstatistics associated with the same virtualized application file.

Thread scope refers to the lifetime of a single thread instance (given aunique PseudoTid value, described below) within a process (and thereforesession). Different threads may be identified in the transcript usingthe ThreadDiscriminate value (described below). If a thread with thesame ThreadDiscriminate value is launched more than once, executionstatistics recorded for the thread (having that ThreadDiscriminatevalue) can be aggregated using the ThreadDiscriminate value (or otheridentifier) to identify execution statistics associated with the samethread or similar threads. As is apparent to those of ordinary skill inthe art, because the ThreadDiscriminate value stores an identifier(e.g., a file name) of an entry point module (e.g., a Dynamic LinkLibrary “dll” file, an executable file, and the like) and a relativeoffset within the module whereat execution of the thread began,different threads may have the same ThreadDiscriminate value.

Each time the virtual application 110 accesses the original file, accessinformation (including one or more execution statistics) is recorded.For example, each time the virtual application 110 accesses the originalfile (e.g., the xlayer file 300), the Sandbox Manager 134 may record aPseudoTid value, an xlayerId value, an AccessOffset value, anAccessBytes value, a TickCount value, and flags. This access isassociated with the PseudoPid value of the process that created thethread.

The xlayerId value is an identifier of the xlayer file 300. The xlayerIdvalue may be a hash (e.g., a “good” hash) of the path of the xlayer file300. The AccessOffset value is an offset in bytes of the portion of thexlayer file 300 accessed. The AccessBytes value is a size in bytes ofthe portion of the xlayer file accessed. The TickCount value is acurrent Operating System (“OS”) tick count at the time the xlayer file300 is accessed. The flags may include a Blocked value implemented asBoolean field. The Blocked value indicates whether the virtual runtimeengine 131 and/or the virtual application 110 is/are blocked fromfurther execution of the page for which access is requested.

During performance of the profiling process 700, data is recorded foreach process over its lifetime. Thus, each process is tracked over theduration of its lifetime. Optionally, shutdown notifications may not betracked.

During performance of the profiling process 700, data is recorded foreach thread over its lifetime. Thus, each thread is tracked over theduration of its lifetime. Optionally, thread-shutdown notifications maynot be tracked.

When the profiling process 700 is performed, it may be useful toaggregate statistics collected for the same application code path. Athread discriminate (the ThreadDiscriminate value) is used to identify acode path by its starting point. The ThreadDiscriminate value may beobtained by performing a hash function using the name of the entry pointmodule (e.g., a file name) and the entry point relative offset withinthe module as input parameters. Optionally, the name of the entry pointmodule may include the file path. The hash function performed may be a32-bit “good” hash function. For example, if the entry point for thethread was in a file named “myapplogic.dll,” and at an offset of0x10025, the hash function is performed on the bytes of the string“myapplogic.dll” using the offset (0x10025) as a seed value. TheThreadDiscriminate value for any xlayer access from this thread is setto the resulting value generated by the hash function. For example, thefollowing pseudo code may be used to generate the ThreadDiscriminatevalue:

ThreadDiscriminate = Hash(<module name>, <relative entry point offset inbytes>)

The ThreadDiscriminate value may be stored in a per-thread datastructure. The following is a non-limiting example of such a structure:

struct CVmTlsData { DWORD UniqueThreadId; DWORD Discriminant; };

By way of a non-limiting example, the ThreadDiscriminate value may bestored in a per-thread data structure (e.g., the structure “CVmTlsData”)using dynamic thread-local-storage mechanisms via Win32::TlsGetValue and::TlsSetValue APIs. As is apparent to those of ordinary skill in theart, thread-local-storage mechanisms refer to storing data in athread-local-storage location that is accessible only by a threadassociated with the thread-local-storage location. TheThreadDiscriminate value and/or the PseudoTid value for a particularthread may be stored in the thread-local-storage location associatedwith the particular thread. The thread may look up theThreadDiscriminate value and/or the PseudoTid stored in thethread-local-storage location and provide such information to thevirtual runtime engine 131, which may in turn, communicate theinformation to the directing process 129.

The structure may be initialized at thread creation time. By way of anon-limiting example, hooking the CreateThread system call may be usedto initialize the structure at thread creation time. In other words, aninstance of the structure “CVmTlsData” may be created in response toeach detection of the CreateThread system call by the hook on theCreateThread system call. Hooking the CreateThread system call is atechnique known to those of ordinary skill in the art and will not bedescribed in detail.

When an application thread is created, a PseudoTid value andThreadDiscriminate value are determined as described above. Then, memoryfor the structure “CVmTlsData” is allocated, and the structure“CVmTlsData” is saved in thread-local-storage. By way of a non-limitingexample, the structure may be saved in thread-local-storage via theWin32::TlsSetValue API. By way of another non-limiting example, thefollowing pseudo code may be used to create a per-thread data structure,which in this example, is the structure “CVmTlsData.”

Intercept application thread creation On new thread creation DoCVmTlsData data = AllocateMemory (sizeof(CVmTlsData)) data.PseudoTid =Hash(GetCurrentThreadId( ), GetSystemTime( )) data.Discriminate =Hash(<module name>, <relative entry point offset in bytes>)::TlsSetValue(VM_TLS_INDEX, data) End

After the PseudoTid value and the ThreadDiscriminate value are stored inthe per-thread data structure (e.g., the structure “CVmTlsData”), eachaccess to the original file (e.g., the xlayer file 300) during executionof the virtual application 110 is recorded by the Sandbox Manager 134 ina transcript file 125 (see FIG. 2). By way of a non-limiting example,the transcript file 125 may have a simple binary format and may use theextension “xt.” The transcript file 125 may include a header followed bya series of tuples that each include a thread identifier (e.g., thePseudoTid value), a timestamp value, and a block identifier or number.Optionally, the transcript file 125 may also store the PseudoPid value.In the transcript file 125, the tuples may be organized by process (orPseudoPid value) in a hierarchical structure.

Named pipe communication may be used to provide communication betweenthe virtual runtime engine 131 and the directing process 129(implemented by the Sandbox Manager 134). Thus, the directing process129 may “listen” to the virtual runtime engine 131 over at least onenamed pipe connection 127 illustrated in FIG. 2. Those of ordinary skillin the art are familiar with the use of named pipes as a means ofimplementing communication between processes. Therefore, named pipeswill not be described in further detail.

FIG. 4 is a flow diagram of the profiling process 700 that recordsaccesses made to the original file (e.g., the xlayer file 300) by thevirtual application 110 as it executes.

In first block 710, the virtual runtime engine 131 receives aninstruction from the Sandbox Manager 134 to execute the virtualapplication 110 in profiling mode. As will be described in more detailbelow, the virtual runtime engine 131 may also receive information(e.g., the SessionId value, and the path to the xlayer file) from theSandbox Manager 134.

Then, in block 715, the virtual runtime engine 131 begins execution ofthe virtual application 110 in profiling mode.

In block 717, the virtual runtime engine 131 connects to the named pipeof the Sandbox Manager 134 to form the named pipe connection 127.

In block 718, the virtual runtime engine 131 constructs a messagecontaining the SessionId value received from the Sandbox Manager 134 inblock and optionally other information (e.g., the Pid value, thePseudoPid value, a ProcessName value, and a Process Name Length value).This message signals the start of a new process. The virtual application110 is associated with a process that may launch one or more additionalprocesses. Thus, the first message received by the Sandbox Manager 134signals the start of the virtual application 110. The Pid value in thefirst message is associated with the virtual application 110 itself. Byway of a non-limiting example, the Pid value may be obtained using afunction named “::GetCurrentProcessId( ).” As mentioned above, thePseudoPid value may be obtained using a hash function. By way of anon-limiting example, the ProcessName value may be obtained using afunction named “GetStartupExecutableName( ).” The ProcessName value is afile name of the entry point executable file of the process. Forexample, the ProcessName value may be the filename of the original file(e.g., the xlayer file 300). However, this is not always the case. TheProcessName value may not be the filename of the original file (e.g.,the xlayer file 300). The ProcessName Value may be used to mergestatistics across processes having the same name.

The following structure named “SProcessConnectMessage” may be used toconstruct the message containing the new process information.

struct SProcessConnectMessage { ULONGLONG SessionId; DWORD Pid; DWORDPseudoPid; DWORD NameLength; WCHAR Name[CWC_MAX_PROCESS_NAME+1]; };

In the above pseudo code, the Name variable stores the ProcessNamevalue. The message constructed in block 718 may inform listeners (e.g.,the directing process 129) that a new process is starting. The messagemay be sent by the virtual runtime engine 131 to the Sandbox Manager 134once for each PseudoPid value.

Then, in block 719, the virtual runtime engine 131 sends the messageconstructed in block 718 to the directing process 129 implemented by theSandbox Manager 134. At this point, communication between the SandboxManager 134 and the virtual runtime engine 131 has been properlyinitialized, and messages including statistics may be sent from thevirtual runtime engine 131 to the Sandbox Manager 134 for recordation ina transcript file.

In next block 720, all read operations (e.g., IStream::Read operations)performed by the virtual application 110 with respect to the originalfile (e.g., the xlayer file 300) are monitored. This may be achieved byabstracting access to the original file through the standard IStreaminterface, which is used to read data from the original file. TheIStream interface is configured to read from and write data to streamobjects. Those of ordinary skill in the art are familiar with readingdata from a file (such as the xlayer file 300) and this process will notbe described in detail.

In decision block 725, the virtual runtime engine 131 determines whethera read operation is being performed on the original file (e.g., thexlayer file 300) or execution of the virtual application 110 hasterminated. The decision in decision block 725 is “ACCESS” when a readoperation has been detected by the virtual runtime engine 131. Thedecision in decision block 725 is “TERMINATED” when the virtual runtimeengine 131 detects execution of the virtual application 110 hasterminated.

A method of detecting when execution of the virtual application 110 hasterminated is described below. When the decision in decision block 725is “TERMINATED,” the method 700 terminates.

When the decision in decision block 725 is “ACCESS,” in decision block755, the virtual runtime engine 131 determines whether this is the firsttime the thread associated with the PseudoTid has accessed the xlayerfile. The data stored in the per-thread data structures (e.g., thestructures “CVmTlsData” described above) may be used to determinewhether this is the first time the thread associated with the PseudoTidvalue has accessed the original file. The decision in decision block 755is “YES” when this is the first time the thread associated with thePseudoTid value has accessed the xlayer file. Otherwise, the decision indecision block 755 is “NO” when this is not the first time the threadassociated with the PseudoTid value has accessed the xlayer file.

When the decision in decision block 755 is “NO,” the virtual runtimeengine 131 advances to block 730.

When the decision in decision block 755 is “YES,” in block 740, thevirtual runtime engine 131 stores the new thread information (e.g., thePseudoTid value, and the ThreadDiscriminate value). In block 740, bothof the PseudoTid value and the ThreadDiscriminate value may be stored inthe per-thread data structure (e.g., the structure “CVmTlsData”). By wayof a non-limiting example, these values may be obtained via theWin32::TlsGetValue API.

Then, in block 760, the virtual runtime engine 131 constructs a messagecontaining the new thread information (e.g., the PseudoTid value and theThreadDiscriminate value). The message constructed in block 760 is sentby the virtual runtime engine 131 to the Sandbox Manager 134 once foreach PseudoTid value. The following structure named“SThreadStartedMessage” may be used to construct the message containingthe new thread information.

struct SThreadStartedMessage { DWORD PseudoTid; DWORD Discriminate; };

The variable named “Discriminate” in the above pseudo code stores aThreadDiscriminate value that is sent when a new thread is created. TheThreadDiscriminate value is an entry point discriminator for the threadaccessing the original file (e.g., the xlayer file 300).

In block 765, the virtual runtime engine 131 sends the messageconstructed in block 760 to the Sandbox Manager 134. Then, the virtualruntime engine 131 advances to block 730.

In block 730, an offset value indicating where in the original file theread operation started and a length value indicating an amount of theoriginal file read are recorded. The offset may be implemented as a64-bit value. The PseudoTid value is also recorded. Further, the currentprocess tick count is recorded as the TickCount value.

In next block 750, a message including the information recorded above(e.g., the PseudoTid value, the xlayerId value, the AccessOffset value,the AccessBytes value, the TickCount value, and flags) is constructed.The message also includes an xlayerId value that is an identifier of theoriginal file (e.g., the xlayer file 300). By way of a non-limitingexample, the message may be implemented using the following datastructure (named “SFeedbackStatsMessage”):

struct SFeedbackStatsMessage { DWORD PseudoTid; DWORD XLayerId; DWORDFlags; DWORD TickCount; ULONGLONG AccessOffset; ULONGLONG AccessBytes;};In the data structure named “SFeedbackStatsMessage,” a flags member maystore the Blocked value (discussed above).

In summary, the Sandbox Manager 134 sends the SessionId value and thepath of the original file to the virtual runtime engine 131. ThexlayerId value may be determined by performing a hash function (e.g., a“good” hash function) on the path. When a new process accesses theoriginal file, the virtual runtime engine 131 sends the Session d value,the Pid value, the PseduoPid value, the ProcessName value, and theProcess Name Length value to the Sandbox Manager 134. The SandboxManager 134 may use this information to associate processes with thesession identified by the SessionId value. Because two differentsessions launched under the directing process 129 (see FIG. 2) may usethe same xlayerId value, the SessionId value is send to the SandboxManager 134 to inform the Sandbox Manager as to which child session sentthe information to the directing process 129 (see FIG. 2).

When a new thread accesses the original file, the virtual runtime engine131 sends the PseudoTid value and the ThreadDiscriminate value to theSandbox Manager 134. For each read operation performed by the virtualapplication 110 on the original file, the virtual runtime engine 131sends the PseudoTid value, the xlayerId value, the AccessOffset value,the AccessBytes value, the TickCount value, and flags to the SandboxManager 134. The Sandbox Manager 134 may use this information toassociate each read operation with the original file identified by thexlayerId value and the thread identified by the PseudoTid value. ThexlayerId value is used because a single session may include theexecution of one or more application file in addition to the originalfile.

Then, in block 752, the virtual runtime engine 131 sends the message“SFeedbackStatsMessage” to the directing process 129. Then, the virtualruntime engine 131 returns to block 720.

The following pseudo code provides a non-limiting example of animplementation of the blocks 755, 740, 760, 765, 730, 750, and 752 ofthe profiling process 700 described above.

Method CaptureXLayerAccess(AccessOffset, AccessBytes) CVmTlsData tlsData= ::TlsGetValue(VM_TLS_INDEX) PseudoTid = tlsData.UniqueThreadIdThreadDiscriminate = tlsData.Discriminant TickCount = ::GetTickCount( )If FirstTimeSeen(PseudoTid) Then SThreadStartedMessage msgNewThreadmsgNewThread.PseusoTid = PseudoTid msgNewThread.Discriminate =ThreadDiscriminate SendMessageToDirectingProcess(msgNewThread) EndSFeedbackStatsMessage msgStats msgStats.PseudoTid = PseudoTidmsgStats.TickCount = TickCount msgStats.AccessOffset = AccessOffsetmsgStats.AccessBytes = AccessBytesSendMessageToDirectingProcess(msgStats)

If the virtual application 110 initiates a child process, the virtualruntime engine 131 will perform block 718 using the same SessionIdreceived in block 710. The named pipe connection 127 created in block717 is used for child processes.

It may be beneficial if the profiling process 700 has as little affecton the running application as possible. In such implementations,communication mechanisms may be very fast and invisible to the runningapplication itself. Using the named pipe of the Sandbox Manager 134 toprovide communication between the virtual runtime engine 131 and thedirecting process 129 may provide such benefits. Thus, the messages sentin blocks 719, 752, and 765 may be sent over the named pipeconnection(s) 127.

On the WINDOWS® platform, named pipes are implemented with multipleinstance support. Thus, multiple clients (e.g., virtual runtime engines)can communicate with a single named pipe server (implemented by theSandbox Manager 134), with each client having an isolated connection tothe same named pipe. In other words, each process (even processesstarted by the process associated with the virtual application) willconnect separately to the named pipe server. On the named pipe server(implemented by the Sandbox Manager 134), multiple connections arehandled via a unique connection handle for each client (e.g., virtualruntime engine). Thus, each virtual runtime engine running a virtualapplication can connect to the name pipe of the same Sandbox Manager 134and send statistics to the single Sandbox Manager.

One named pipe connection per process may be used. In suchimplementations, access to the named pipe from multiple threads may beserialized within a process via a critical section. This may impactperformance of the virtual application 110 slightly. However, the sizeof the data being sent is small and named pipe communication isinherently fast. Thus, this method may provide satisfactory performance.

FIG. 5 is a flow diagram of a method 800 performed by the directingprocess 129 implemented by the Sandbox Manager 134. When the virtualapplication 110 is launched by the Sandbox Manager 134 (e.g., by acommand received by the virtual runtime engine 131 from the SandboxManager in block 710 of the profiling process 700 illustrated in FIG.4), the Sandbox Manager 134 may provide information (e.g., one or morecommand line parameters) to the virtual runtime engine 131. Thisinformation may include the SessionId value and the path to the originalfile (e.g., the xlayer file 300). The SessionId value may be the samesession identifier value used by a connection between the ClientApplication 132 (e.g., the plug-in 136) and the Sandbox Manager 134(described in U.S. patent application Ser. No. 12/695,107). TheSessionId value is passed to the virtual runtime engine 131 so thedirecting process 129 can associate all statistics with the correctvirtual application instance, in the event multiple virtual applicationsare executing and being profiled concurrently.

In first block 810, the Sandbox Manager 134 obtains information (e.g.,command line parameters) to send to the virtual runtime engine 131 alongwith a command to execute the virtual application 110 in profiling mode.By way of a non-limiting example, the SessionId may have been obtainedvia a /XExecutionSession command line parameter.

In block 815, the Sandbox Manager 134 sends the information and acommand to execute the virtual application 110 in profiling mode to thevirtual runtime engine 131. The virtual runtime engine 131 knows it wasstarted by a parent process (the directing process 129 of the SandboxManager 134). With that information, the virtual runtime engine 131initiates the named pipe communication with the Sandbox Manager 134 tosend messages (including those with execution statistics) to thedirecting process 129.

The execute command and the SessionId value are received by the virtualruntime engine 131 in block 710 of the profiling process 700 illustratedin FIG. 4 and described above.

As discussed above, while the virtual application 110 is executing inprofiling mode, the Sandbox Manager 134 may receive messages from thevirtual runtime engine 131 and generate events in response to thosemessages.

In decision block 820, the Sandbox Manager 134 determines whether it hasreceived a message from the virtual runtime engine 131 or execution ofthe virtual application 110 has terminated. If a message is received,the decision in decision block 820 is “RECEIVED” and the Sandbox Manager134 advances to decision block 825. Otherwise, if the virtual runtimeengine 131 stops executing the virtual application 110 before a messageis received, the decision in decision block 820 is “TERMINATED” and themethod 800 terminates.

When the virtual runtime engine 131 detects that a process is accessingthe original file (e.g., the xlayer file 300) for the first time, thevirtual runtime engine 131 sends a message (optionally implemented usinga structure name “SProcessConnectMessage”) to the directing process 129.In decision block 825, the Sandbox Manager 134 determines whether themessage received in block 820 indicates a process is accessing theoriginal file (e.g., the xlayer file 300) for the first time. Thedecision in decision block 825 is “YES” when the message received inblock 820 indicates a process is accessing the original file (e.g., thexlayer file 300) for the first time. For example, the decision indecision block 825 is “YES” when the message received was constructed inblock 718 of the profiling process 700 illustrated in FIG. 4. Otherwise,the decision in decision block 825 is “NO” when the message received inblock 820 does not indicate the process is accessing the original file(e.g., the xlayer file 300) for the first time.

When the decision in decision block 825 is “YES,” in block 830, theSandbox Manager 134 generates a ProcessStarted event. In block 835,Sandbox Manager 134 records information included in the message (e.g.,the SessionId, PseudoPid, and ProcessName values). This information maybe recorded in the transcript file 125 (see FIG. 2). Then, the SandboxManager 134 advances to decision block 870.

When the decision in decision block 825 is “NO,” in decision block 840,the Sandbox Manager 134 determines whether the message received in block820 includes statistics to be stored in the transcript file 125 (seeFIG. 2). The decision in decision block 840 is “YES” when the messagereceived in block indicates the message received in block 820 includesstatistics to be stored in the transcript file 125. For example, thedecision in decision block 840 is “YES” when the message received wasconstructed in block 750 of the profiling process illustrated in FIG. 4.Otherwise, the decision in decision block 840 is “NO” when the messagereceived in block 820 does not indicate that the message received inblock 820 includes statistics to be stored in the transcript file 125.

When the decision in decision block 840 is “YES,” in block 845, theSandbox Manager 134 generates an ExecutionStatistic event. Then, inblock 850, the statistics included in the message are stored in thetranscript file 125. Then, the Sandbox Manager 134 advances to decisionblock 870.

When the decision in decision block 840 is “NO,” in decision block 855,the Sandbox Manager 134 determines whether the message received in block820 indicates a thread is accessing the original file (e.g., the xlayerfile 300) for the first time. The decision in decision block 855 is“YES” when the message received in block 820 indicates a thread isaccessing the original file for the first time. Otherwise, the decisionin decision block 855 is “NO.”

When the decision in decision block 855 is “YES,” in block 860, theSandbox Manager 134 generates a ThreadStarted event. Then, in block 865,the PseudoTid and ThreadDiscriminate values are stored in memory. Thisinformation may be recorded in the transcript file 125 (see FIG. 2).Then, the Sandbox Manager 134 advances to decision block 870.

When the decision in decision block 855 is “NO,” the Sandbox Manager 134advances to decision block 870.

In decision block 870, the Sandbox Manager 134 determines whether thevirtual runtime engine 131 has stopped executing the virtual application110 (and therefore, no additional statistics will be generated for thevirtual application 110). The decision in decision block 870 is “NO”when the virtual runtime engine 131 has stopped executing the virtualapplication 110. Otherwise, the decision in decision block 870 is “YES.”

When the decision in decision block 870 is “NO,” the method 800terminates.

When the decision in decision block 870 is “YES,” the Sandbox Manager134 returns to decision block 820.

The information received in the messages constructed in block 750 of theprofiling process 700 illustrated in FIG. 4 is stored in the transcriptfile 125 associated with the original file (e.g., the xlayer file 300).

The Sandbox Manager 134 may include a dictionary accessible by thedirecting process 129. The directing process 129 may use the dictionaryto associate all subsequent messages (e.g., implemented using thestructures named “SThreadStartedMessage” and “SFeedbackStatsMessage”)with the correct PseudoPid value. The dictionary may be keyed by aconnection handle to a structure storing the PseudoPid value, Pid value,and Process Name value. The following data structure (named“SPipeConnection”) is an example of a data structure that may be used toimplement the dictionary:

class SPipeConnection { private uint SessionId; private uint Pid;private uint PseudoPid; private string Name; };

As described above, the information stored in the class defined by thepseudo code above is received by the Sandbox Manager 134 (from thevirtual runtime engine 131) in the message constructed in block 718 ofthe profiling process 700 illustrated in FIG. 4.

The dictionary lookup may be hidden by the implementation of the .NETSystem.IO.Pipes.NamedPipeServerStream class, which may have been used toperform the named pipe communication. This class uses IO CompletionPorts to schedule asynchronous pipe reads from the pipe clients (e.g.,the virtual runtime engine 131) in the virtual application processes. Anasynchronous named pipe completion routine may be responsible fordetermining the type of message received, reading the message, andcalling back into the listening code of the directing process 129 withthe appropriate callbacks. Possible callbacks are: SignalNewProcess(which is called when a new process is started in the virtualapplication 110); SignalNewThread (which is called when a new thread isstarted within a virtual application process); and SignalXLayerAccess(which is called when access to the original file has been requested bya particular thread within the virtual application process). How thisdata provided by these callbacks is handled is described below.

The following pseudo code provides a non-limiting example of aserver-side named pipe completion routine. Portions of the routine maybe performed in blocks 820, 825, 840, and 855.

SPipeConnection pipeConnect = GetConnectionDataFromHandle(hPipeClient)Byte MessageId = ReadByte( ) If (MessageId == ConnectionMessageId) ThenpipeConnect.SessionId = ReadInt64( ) pipeConnect.Pid = ReadInt32( )pipeConnect.PseudoPid = ReadInt32( ) countChars = ReadInt32( )arrayChars = ReadChars(countChars) pipeConnect.Name =MakeString(arrayChars) SignalNewProcess(pipeConnect.SessionId,pipeConnect.Pid, pipeConnect.PseudoPid, pipeConnect.Name) Else If(MessageId == ThreadCreatedMessageId) Then PseudoTid = ReadInt32( )Discriminate = ReadInt32( ) SignalNewThread(pipeConnect.PseudoPid, PseudoTid, Discriminate) Else If (MessageId == FeedbackStatsMessageId)Then PseudoTid = ReadInt32( ) TickCount = ReadInt32( ) AccessOffset =ReadInt64( ) AccessSize = ReadInt64( ) SignalXLayerAccess(pipeConnect.PseudoPid, PseudoTid,  TickCount, AccessOffset, AccessSize) End

Building and Distributing Application Profiles Via the Web

As mentioned above, the transcript file 125 generated by the profilingprocess is used to determine a predictive application access model thatis used to determine an order in which to download blocks of data (e.g.,portions of the xlayer file 300) to the client computing device 9. Whenused to stream blocks of data or pages to the client computing device 9,the access model is referred to as a streaming model.

The server computing device 7 provides applications to the clientcomputing device 9 on a “self-serve” basis (i.e., a user operating theclient computing device 9 may select any of the applications provided bythe server computing device 7 for download at anytime). After the userhas selected an application for download and execution, the servercomputing device 7 downloads or streams the selected application to theclient computing device 9. Multiple client computing devices (e.g., thecomputing devices 9 and 11) may select applications for download at thesame time.

Because training and building streaming models is a computationallyintensive process and relies on proprietary technologies, it may bepreferable to perform this process on a centralized server (e.g., theserver computing device 7 or another computing device connectedthereto). The access model may be generated using machine learningtechniques that require training. The training of streaming modelsrequires information about the program's access patterns under realisticand/or actual use. Thus, generating “transcripts” via profiling is atask best performed manually, by an application publisher or test users.

As described above, the Sandbox Manager 134 may be configured to profilean application downloaded from a web page (e.g., via the plug-in 136).Transcript files generated by the Sandbox Manager 134 may then beuploaded to the server computing device 7 (or another computing deviceconnected thereto), which automatically generates and distributes astreaming model (e.g., the streaming model 122 illustrated in FIG. 19)for the application.

As mentioned above, the authoring tool 170 allows application developersand publishers to virtualize an application and publish it to the web.The result of this process is one or more executable files or xlayerfiles (e.g., a file named “application_p.xlayer”) residing on the servercomputing device 7. As described in U.S. patent application Ser. No.12/695,107, these files can be downloaded and executed from the web viathe plug-in 136 and the Sandbox Manager 134. If the plug-in 136 isexecuting on a computing device (e.g., the computing device 11) that isalso executing the authoring tool 170, optionally, when the layer fileis published to the server computing device 7, the xlayer file will alsobe copied to the local cache 139 (see FIG. 2), making future downloadsunnecessary.

An upper portion of FIG. 13 illustrates exemplary communications betweenthe computing device 11 operated by an application publisher ordeveloper, the server computing device 7, and the model building server8. A lower portion of FIG. 13 illustrates exemplary communicationsbetween the client computing device 9 operated by a user and the servercomputing device 7. In FIG. 13, the authoring tool 170, the profilingtool 169, and the Sandbox Manager are installed and operating on thecomputing device 11. Another instance of the Sandbox Manager 134 and theClient Application 132 are installed and operating on the clientcomputing device 9. For ease of illustration, the computing deviceoperated by an application publisher will be described as being thecomputing device 11. However, this is not a requirement.

FIG. 9 is a flow diagram of a method 1100 of building a streaming model(e.g., the streaming model 122 illustrated in FIG. 19) for a particularapplication (e.g., the virtual application 110) and distributing thatstreaming model across multiple servers (e.g., the server computingdevices 6 and 7 illustrated in FIG. 1). Before the method 1100 isperformed, the application publisher or developer has published theapplication (e.g., the virtual application 110) to the server computingdevice 7. Turning to FIG. 13, arrow “A1” illustrates a communicationfrom the computing device 11 operated by the application publisher ordeveloper publishing the application (e.g., the virtual application 110)to the server computing device 7.

Returning to FIG. 9, in first block 1110, the server computing device 7receives an instruction from an application publisher or developer thata particular application is to be profiled. Arrow “A2” in FIG. 13illustrates a communication from the computing device 11 to the servercomputing device 7 requesting profiling for an application. Theauthoring tool 170 may be configured to allow an application publisheror developer to specify that after an application is downloaded, theSandbox Manager 134 is to profile the application and upload transcriptfiles (generated by the profiling process 700 illustrated in FIG. 4) tothe server computing device 7. For example, the authoring tool 170 mayhave a link to an online management panel configured to display aprofiling tool 169 (see FIGS. 3 and 13) operable by a user to indicate aparticular application is to be profiled following its download. Usingthe online management panel the user selects a virtual application(e.g., by selecting an xlayer file implementing the virtualapplication). For example, the publisher or developer may select avirtual application implemented by an xlayer file named “app.xlayer.” Ifan application has been identified as “to be profiled,” streaming is notenabled. Instead, to run the application from the web, the entireapplication file (e.g., the xlayer file named “application_p.xlayer”)must be downloaded before execution can begin. Thus, arrow “A3” in FIG.13 illustrates a communication downloading the xlayer file from theserver computing device 7 to the computing device 11.

The profiling tool 169 may be implemented as a “Profile” link in theonline management panel. When the publisher clicks on the “Profile”link, a panel launcher page may be displayed that includes a querystring parameter (e.g., “&profile=”) set to a value that indicates theapplication should be profiled. The page may pass the query stringparameter (e.g., “&profile=”) to an iframe that renders the panellauncher page. The panel launcher page renders a javascript call to thexrfw.go( ) method that sets the query string parameter (e.g.,“&profile=”) equal to “TRUE.”

In block 1115, the server computing device 7 receives an instruction todownload the virtual application 110 to the client computing device 9.For example, this instruction may be received in response to a userclicking on a launch button on the panel launcher page.

In block 1120, the Sandbox Manager 134 downloads and executes thevirtual application file 140 in a profile mode. When executing anapplication in profile mode, the Sandbox Manager 134 instructs thevirtual machine (e.g., the virtual runtime engine 131) to provideexecution statistics (e.g., via messages implemented using the structurenamed “SFeedbackStatsMessage”).

In block 1125, the Sandbox Manager 134 receives messages from thevirtual runtime engine 131 and handles events generated by the virtualruntime engine 131 executing the application as the application isrunning. The method (described above) may be performed in blocks 1120and 1125.

By way of non-limiting examples, the events may include a ProcessStartedevent, a ThreadStarted event, an ExecutionStatistic event, and anApplicationEnded event. A ProcessStarted event may be identified by theSandbox Manager 134 when the directing process 129 receives a messagefrom the virtual runtime engine 131 indicating a process has requestedaccess to the xlayer file for the first time. As explained above, such amessage may be sent by the virtual runtime engine 131 in block 719 ofthe profiling process 700 illustrated in FIG. 4 and implemented usingthe structure named “SProcessConnectMessage.” A ThreadStarted event maybe identified by the Sandbox Manager 134 when the directing processreceives a message indicating a thread has requested access to thexlayer file for the first time. As explained above, such a message maybe sent by the virtual runtime engine 131 in block 765 of the profilingprocess 700 illustrated in FIG. 4 and implemented using the structurenamed “SThreadStartedMessage.” The ProcessStarted and ThreadStartedevents allow the Sandbox Manager 134 to separately track access requestsfrom different processes and threads.

An ExecutionStatistic event may be identified by the Sandbox Manager 134when the directing process 129 receives a message including accessstatistics. As explained above, such a message may be sent by thevirtual runtime engine 131 in block 752 of the profiling process 700illustrated in FIG. 4 and implemented using the structure named“SFeedbackStatsMessage.” Every time the virtual application 110 finishesreading a contiguous section of an xlayer file 300, the virtual runtimeengine 131 triggers an ExecutionStatistic event and sends a messageincluding access statistics to the directing process. The message, whichmay be implemented using the structure named “SFeedbackStatsMessage” mayinclude an identifier for the xlayer file (e.g., the xlayerId value),the thread (e.g., the PseudoTid value), time (e.g., the TickCount value,timestamp, and the like), the location of the block in the xlayer file(e.g., the AccessOffset value), and the size of the block read (e.g.,the AccessBytes value). The TickCount value may be used to track theruntime of a process. An identifier for the process (e.g., the PseudoPidvalue) may be inferred from the named pipe connection used because thenamed pipe connection used by each process is unique.

In next block 1130, the Sandbox Manager 134 detects that anApplicationEnded event has been triggered.

Then, in block 1135, the Sandbox Manager 134 combines the collectedexecution statistics into a single combined transcript (e.g., thecombined transcript “CT” illustrated in FIG. 6).

In block 1140, the Sandbox Manager 134 uploads the combined transcriptto the server computing device 7. Arrow “A4” in FIG. 13 illustrates acommunication from the computing device 11 to the server computingdevice 7 uploading the combined transcript. In block 1140, the SandboxManager 134 may connect to a web service running on the server computingdevice 7, and transfer a unique application identifier and a byte arraycontaining the binary data of combined transcript to the servercomputing device 7. By way of a non-limiting example, the applicationidentifier may have the following format:<AppInternalName>/<AppVersion>_<LayerRevision>/<AppInternalName>_p.xlayer.

In block 1145, the server computing device 7 receives the uploadedcombined transcript and associated application identifier.

In block 1150, the server computing device 7 resolves the applicationidentifier to determine which application and version created thetranscript. The server computing device 7 includes an applicationlibrary database 1151 illustrated in FIG. 11. In block 1150, theapplication library database may be queried for an application that hasa matching version and xlayer revision. If an xlayer file is found, thetranscript will be associated with this xlayer file.

In block 1155, the server computing device 7 saves the combinedtranscript in a predetermined location on the filesystem. In block 1155,the binary data contained in the transcript may be written to a file onthe server computing device 7 using a standard .NET BinaryWriter. Eachtranscript is named using a unique GUID. Files containing thetranscripts may be stored at the following location, relative to the webroot:Layers\Transcripts\<AppInternalName>\<AppVersion>_<LayerRevision>\<AppInternalName>_p.xlayer\<GUID>.xt.

In block 1160, the server computing device 7 requests a build of a newstreaming model for the xlayer file identified in block 1150. Arrow “A5”in FIG. 13 illustrates a communication from the server computing device7 to the model building server 8 requesting a build of a new streamingmodel for the xlayer file identified in block 1150. If a streaming modelhas not been created for a particular xlayer file, in block 1160, theserver computing device 7 may automatically add a request for astreaming model to a streaming model build queue. By way of anon-limiting example, the streaming model build queue may be implementedas a ModelRequest table 1161 illustrated in FIG. 10. In implementationsincluding multiple model build servers, the ModelRequest table 1161 maybe stored in a database accessible by all model build servers.

Application publishers can use the profiling tool 169 to requestsubsequent model builds as needed (e.g., by adding a request to theModelRequest table illustrated in FIG. 10), after additional profilinghas been performed to generate additional transcripts. This may beachieved by adding a record to the ModelRequest table illustrated inFIG. 10.

In block 1165, the request is processed and a streaming model (e.g., thestreaming model 122 illustrated in FIG. 19) is generated for the xlayerfile identified in block 1150. The streaming model may be generated bythe server computing device 7 or another computing device connectedthereto. In the embodiment illustrated in FIG. 1, streaming models aregenerated by the model building server 8. By way of a non-limitingexample, an application running as a windows service on the modelbuilding server 8 may be responsible for building the streaming modelbased on the transcripts associated with the unique applicationidentifier. The model building server 8 may periodically query theModelRequest table 1161 for any requests that have not yet been started.When one is found, the model building server 8 begins a build (i.e.,starts constructing a streaming model).

FIG. 20 illustrates a method 1300 of building the streaming modelillustrated in FIG. 19 that may be performed in block 1165 of the methodillustrated in FIG. 9. To build the streaming model, in block 1310, themodel building server 8 first collects transcripts associated with thexlayer file identified in block 1150 (which may be stored on multipleserver computing devices, such as the server computing devices 6 and 7illustrated in FIG. 1). In implementations that include more than onemodel building server 8, the server computing devices may networked, andshare a (LibraryResources) folder at the base of their applicationlibrary resources, so that each can access the other using the followingpath “\\<ServerName>\LibraryResources\.” Transcript files associate witha particular xlayer file can be stored on one or more different servercomputing devices. If the transcript files associated with a particularxlayer file are stored on a particular server computing device, then thetranscript files can be retrieved from that particular server computingdevice using a consistent folder structure (e.g.,“<ServerHostName>\LibraryResources\Layers\Transcripts\ . . . ”). Inother words, a predetermined path may be used to obtain transcript filesfrom different server computing devices that each store transcript filesin the same storage location. If a transcript file is not stored on aparticular server computing device, the server computing device willissue an error.

Then, in block 1310, the model building server 8 copies all transcriptfiles associated with the xlayer file identified in block 1150 into thesame directory in the filesystem of the model building server 8. Forexample, all files stored in a first directory named“\\<SpoonServer>\LibraryResources\Layers\Transcripts\<AppInternalName>\<AppVersion>_<LayerRevision>\<AppInternalName>_p.xlayer\”may be copied to a second directory named“\\<BuildServer>\LibraryResources\Layers\Transcripts\<AppintemalName>\<AppVersion>_<LayerRevision>\<AppInternalName>_p.xlayer.\”Arrow “A6” in FIG. 13 illustrates a communication from the servercomputing device 7 to the model building server 8 uploading thetranscript files to the model building server 8.

When the copying is finished, in block 1320, the model building server 8tries to delete the original transcript files (stored in the firstdirectory).

In decision block 1325, the model building server 8 determines whetherthe transcript files have been successfully deleted. If the attempt todelete a particular transcript file fails, the model building server 8concludes the transcript is still being written and the decision indecision block 1325 is “NO.” Then, in block 1330, the copy stored in thesecond directory is deleted. These copy and delete actions may use thestandard .NET File class.

In block 1335, the model building server 8 then performs a method 1600(illustrated in FIG. 23) to construct a streaming model based on thetranscripts stored in the second directory. The collection of files(including the transcripts stored in the second directory and thestreaming model) may be stored in a third directory named“\\<BuildServer>\LibraryResources\Layers\<AppInternalName>\<AppVersion>_<LayerRevision>\xstream\0\.”

In block 1340, referring to FIG. 12, when the streaming model is saved,the model building server 8 creates a record in an XStreamModel table1166, as well as corresponding entries in an XFile table 1167 and aServerXFile table 1168. Arrow “A7” in FIG. 13 illustrates acommunication from the model building server 8 to the server computingdevice 7 recording information in the XStreamModel table 1166, the XFiletable 1167, and the ServerXFile table 1168. These tables may be storedin the same database used to store the ModelRequest table 1161. Thisdatabase may be accessible by each of the server computing devices andmodel building servers.

Referring to FIG. 19, a streaming model (e.g., the streaming modelillustrated in FIG. 19) includes a streaming model file 1180, and one ormore xsequence files 1182.

Returning to FIG. 12, the records in the XFile table 1167 andServerXFile table 1168 indicate the existence of a new streaming model,and identify on which server(s) the streaming model is stored. Theserver table 1169 stores information about each of the server computingdevices (e.g., the server computing devices 6 and 7). The XStreamModeltable 1166 indicates a particular streaming model exists, the XFiletable 1167 stores data about the streaming model file 1180, and theServerXFile table 1168 describes the streaming model file located on aparticular server computing device. Arrow “A8” in FIG. 13 illustrates acommunication from the model building server 8 to the server computingdevice 7 storing the streaming model file 1180 and associated one ormore xsequence files 1182 on the server computing device 7. Optionally,the model building server 8 may store the streaming model file 1180 andassociated one or more xsequence files 1182 on one or more other servercomputing devices. The streaming model (which includes the streamingmodel file 1180 and associated one or more xsequence files 1182) may bestored in a predetermined storage location on the server computingdevice 7.

At this point, the streaming models may be distributed to othercomputing devices connected to the model building server 8 and/or thenetwork 10. FIG. 21 is a flow diagram of a method 1400 of distributingstreaming models. Server computing devices (e.g., the server computingdevices 6 and 7) may poll or query the ServerXFile table 1168 to locatefiles stored on other server computing devices. In first block 1410, aquerying server computing device (e.g., the server computing device 6)polls or queries the ServerXFile table 1168 for streaming models storedon other server computing devices (e.g., the server computing device 7).For example, in block 1410, the server computing device 6 may receive alist of streaming models identified in the ServerXFile table 1168 thatare stored on all other server computing devices.

In decision block 1415, for each streaming model identified in block1410, the querying server computing device determines whether thestreaming model is already stored in the filesystem of the queryingserver computing device. The decision in decision block 1415 is “NO”when the streaming model is already stored in the filesystem of thequerying server computing device. Otherwise, the decision in decisionblock 1415 is “YES” when the streaming model is not already stored inthe filesystem of the querying server computing device.

When the decision in decision block 1415 is “YES,” in block 1425, thequerying server computing device waits for a period of time and thenreturns to block 1410. In block 1425, the querying server computingdevice may wait for a predetermined amount of time, a randomly selectedamount of time, or a combination thereof.

When the decision in decision block 1415 is “YES,” in block 1430, thestreaming model is copied from a server computing device on which thestreaming model is stored to the querying server computing device. Thus,when a record is found in the ServerXFile table 1168 that the queryingserver computing device does not yet have stored in its filesystem(according to the ServerXFile table), a copy is initiated. In otherwords, the querying server computing device (e.g., the server computingdevice 6) may use the ServerXFile table 1168 to locate model filesstored on other server computing devices (e.g., the server computingdevice 7) and copy those files to the local filesystem of the queryingserver computing device. The files located in this manner may be copiedfrom the third directory to a fourth directory named“\\<SpoonServer>\LibraryResources\Layers\<AppInternalName>\<AppVersion>_<LayerRevision>\xstream\0\.”In other words, each server computing device is responsible fordistributing streaming model files by copying those files onto their ownfilesystem.

In decision block 1435, for each streaming model copied in block 1430,the querying server computing device determines whether the streamingmodel was copied to the filesystem of the querying server computingdevice successfully. The decision in decision block 1435 is “YES” whenthe streaming model was copied to the filesystem of the querying servercomputing device successfully. Otherwise, the decision in decision block1435 is “NO” when the streaming model was not copied to the filesystemof the querying server computing device successfully.

When the decision in decision block 1435 is “NO,” the querying servercomputing device may return to block 1430 to retry the copy operation.

When the decision in decision block 1435 is “YES” (the copy operationhas completed successfully), in block 1440, the querying servercomputing device (e.g., the server computing device 6) adds a new recordto the ServerXFile table 1168, indicating that the streaming model isnow stored on that particular server computing device. Thus, after aserver computing device (e.g., the server computing device 6) copiesstreaming models onto its filesystem, the server computing devicerecords this in the database illustrated in FIG. 12. For example, if aserver computing device named “publicserver1” copies a streaming modelnamed “Model1” into its filesystem, the “publicserver1” computing devicecreates a record in the ServerXFile table 1168 in which a field named“Server” is set to “publicserver1.” Then, the method 1400 terminates.

FIG. 22 illustrates a flow diagram of a method 1500 of locating astreaming model. A server table 1169 may be used to list all servers onwhich streaming models may be stored. If the querying server computingdevice is indicated as being “Public” in the server table 1169illustrated in FIG. 12, pages that render the plug-in 136 will read arecord in the ServerXFile table 1168 (associated with the queryingserver computing device) and may instruct the plug-in 136 to use the newstreaming model copied onto the querying server computing device onsubsequent application launches. In first block 1510, a user operatingthe client computing device 9 indicates he/she would like to execute avirtual application (e.g., the virtual application 110). By way of anon-limiting example, in block 1510, the user may click on a hyperlink(displayed in a web browser) provided by the server computing device 7and associated with the virtual application.

In optional block 1515, the Client Application 132 communicates that theuser would like to execute a virtual application to the Sandbox Manager134.

In block 1520, the Sandbox Manager 134 executing on the client computingdevice 9 (which may be located somewhere across the world from theserver computing device 7) requests the virtual application the userindicated he/she would like to execute in block 1510.

In block 1530, the server computing device that services the request(e.g., the server computing device 7) will query the ServerXFile table1168 to determine which server computing device(s) is/are storing thestreaming model for the application requested in block 1520. Forexample, in block 1520, the Sandbox Manager 134 may request anapplication named “App1.xlayer” for which a streaming model named“Model1” was created. In this example, in block 1530, the servercomputing device 7 may query the ServerXFile table 1168 to determinewhich server computing device(s) are storing the streaming model named“Model1” associated with the application requested in block 1520.

Then, in block 1535, the server computing device that services therequest (e.g., the server computing device 7) selects one of the servercomputing device(s) storing the streaming model requested in block 1520from which to download the streaming model. Load balancing techniques ora random selection algorithm may be used to select a server computingdevice in block 1535. For example, in block 1535, load balancingtechniques or a random selection algorithm may be used to select aserver computing device (e.g., the “publicserver1” computing device)from which the “Model1” model file may be downloaded to the clientcomputing device 9.

Then, in block 1540, the method 900 (illustrated in FIG. 18) isperformed to download and execute the virtual application on the clientcomputing device 9 using the streaming model. Then, the method 1500terminates.

Modeling

FIG. 23 illustrates the method 1600 of constructing a streaming model(e.g., the streaming model 122 illustrated in FIG. 19). As mentionedabove, multiple transcripts are recorded during profiling process 700and later combined to build a streaming model (e.g., the streaming model122 illustrated in FIG. 19) for an application (e.g., the virtualapplication 110). In first block 1610, referring to FIG. 19, theindividual transcripts (e.g., the transcript “T1” and “T2”) are combinedto form a combined transcript “CT.”

Among other data, each transcript includes information identifyingtransitions between pages (“page transitions”). To combine thetranscripts, in block 1610, the page transitions are broken down andcombined. For example, referring to FIG. 6, if a first transcript “T1”records a first sequence of page transactions (P6

P4

P5

P2

P3) indicating a first order in which the pages P6, P4, P5, P2, and P3were accessed by the application, and a second transcript “T2” records asecond sequence of page transactions (P6

P4

P5 P1

P3) indicating a second order in which the pages P6, P4, P5, P1, and P3were accessed by the application, the transcripts “T1” and “T2” arebroken down into individual transitions: (P6

P4), (P4

P5), (P5

P2), (P2

P3) for the first transcript “T1” and (P6

P4), (P4

P5), (P5

P1), (P1

P3) for the second transcript “T2.” In this example, the first sequence(in the first transcript “T1”) transitioned from page P6 to page P4 topage P5 to page P2 to page P3 and the second sequence (in the secondtranscript “T2”) transitioned from page P6 to page P4 to page P5 to pageP1 to page P3. Because a transition from page P6 to page P4 is presentin both transcripts “T1” and “T2,” in block 1610, this transition (P6

P4) is combined into a single transition and assigned a weight “W”(indicating how many times the transition appears in the transcripts,e.g., a weight equal to two) in a combined transcript “CT.” Similarly,because a transition from page P4 to page P5 is present in bothtranscripts “T1” and “T2,” in block 1610, this transition (P4

P5) is combined into a single transition and assigned a weight “W”(indicating how many times the transition appears in the transcripts,e.g., a weight equal to two) in a combined transcript “CT.” The othertransitions appear in only one transcript. Therefore, in this example,in block 1610, these transitions are each assigned a weight equal toone. Further, a timestamp value may be stored for each page indicating atime at which the page was first accessed. After transitioning to pageP5, the first and second transcripts “T1” and “T2” indicate the user maytransition to either page P2 or page P1. Thus, the combined transitionsinclude a branch “B1” and no longer follow a linear path.

After the individual transcripts have been combined to form the combinedtranscript “CT,” in block 1620, the combined transcript “CT” is used tocreate a directed graph structure “SD.” The directed graph structure“SD” includes states and transitions between states. The states aremerely end points (or nodes) for the transitions. Each transition isassociated with one or more pages. The directed graph structure “SD”illustrated in FIG. 6 includes five states S1 to S5, and fivetransitions TRANS-1 to TRANS-5.

In the directed graph structure “SD,” linear sequences of transitions(i.e., sequences of transitions without any branches) in the combinedtranscript “CT” are reduced or simplified into a single transition. Forexample, the linear sequence of transitions that includes the followingtransitions (P6

P4

P5), is simplified into the single transition TRANS-1 (or S1

S2) that is associated with the pages P6, P4, and P5. The weight oftransition TRANS-1 is the same as the weight of each of the transitions(P6

P4

P5). The transition TRANS-2 (or S2

S3) is associated with the pages P5 and P1. The transition TRANS-3 (orS2

S4) is associated with the pages P5 and P2. The transition TRANS-4 (orS3

S5) is associated with the pages P1 and P3. The transition TRANS-5 (orS4

S5) is associated with the pages P2 and P3.

When the states and transitions are created by combining the transitionsin the combined transcript “CT,” a timestamp delta valued is calculatedfor each page. The timestamp delta is the difference between the starttime of the transcript (e.g., a time at which execution of the virtualapplication began) and the timestamp recorded for the page in thetranscript. Then, an average timestamp delta value is calculated for thepages associated with each of the transitions between states. Thisaverage is recorded for each transition between states as a TickDeltamember.

The directed graph structure “SD” describes data access by theapplication while executing and may be stored in one or more stateobjects. Referring to FIG. 24, each of the states (e.g., the states S1to S5) may be stored in a different state object 1660. The state object1660 may include a list of transitions 1662 associated with the state.For example, the list of transitions for a state object corresponding tothe state S1 would include only the transition TRANS-1. By way ofanother example, the list of transitions for a state objectcorresponding to the state S2 would include the transitions TRANS-2 andTRANS-3. The state object 1660 may include a degree member 1664 thatindicates a number of transitions associated with the state object 1660.For example, the degree member of the state object corresponding to thestate S1 would indicate only a single transition is associated with thestate object (e.g., degree=1). By way of another example, the degreemember of the state object corresponding to the state S2 would indicatetwo transitions are associated with the state object (e.g., degree=2).The state object 1660 may include a weight member 1666 that stores atotal of the weights assigned to the transitions. For example, theweight member of the state object corresponding to the state S1 may beset to a weight of two. By way of another example, the weight member ofthe state object corresponding to the state S2 may be set to a weight oftwo. The weight members of state objects corresponding to the states S3and S4 may each be set to a weight of one.

Referring to FIG. 25, each of the transitions may be stored in atransition data structure 1670 that has a weight member 1672 indicatinghow many times the transition occurs in the combined transcript. Thetransition data structure may include a page sequence member 1674 thatstores the page identifiers of the pages included in the transition. Forexample, the page sequence member of a transition data structure storingthe transition TRANS-1 would store identifiers for pages P6, P4, and P5.The transition data structure 1670 may include a TickDelta member 1676that stores an amount of time (e.g., in nanoseconds) that the transitionrequired.

The directed graph structure “SD” (stored by the one or more stateobjects) may include loops or cycles. By way of a non-limiting example,the directed graph structure “SD” may be a directed acyclic graph(“DAG”). However, this is not a requirement. As mentioned above, in thedirected graph structure “SD,” the transitions (or “edges”) are labeledwith a set of pages or data blocks.

Transition data structures that are too large may be divided into two ormore separate transition data structures. For example, transition datastructures that have a large value stored in the TickDelta member, orhave a large number of pages stored in the page sequence member may besubdivided into two or more separate transition data structures.

In block 1630, the pages identified in the page sequence members of thetransition data structures are encoded in one or more xsequence files.The xsequence files each belong to one of three categories: initialexecution xsequence files, sequence xsequence files, and rest xsequencefiles. For example, the xsequence files 1182 of the streaming model 122illustrated in FIG. 19 include a initial execution xsequence file 1632,a sequence xsequence file 1634, and a rest xsequence file 1636.

As mentioned above, the virtual application 110 may be streamed from theserver computing device 7 without using a special streaming protocol byencoding the xlayer file into smaller xsequence files. In particularembodiments, the virtual application 110 may be streamed from the servercomputing device 7 using well-known download protocols, such as HTTP,FTP, SMB, and the like. Which category a particular page is encoded intois based upon the directed graph structure “SD” which predicts when thepage may be used by a virtual application as it is executing asxsequence files are concurrently being downloaded.

FIG. 26 is a flow diagram of a method 1700 of encoding the pages of thedirected graph structure “SD” into xsequence files. The method 1700 maybe performed in block 1630 of the method 1600 illustrated in FIG. 23. Infirst block 1710, the model building server 8 identifies the pages to bestored in the initial execution xsequence files. Initial executionxsequence files contain pages that must be downloaded before the virtualapplication (e.g., the virtual application 110) launches. For example,depending upon the implementation details, the user may see a bufferingdialog while initial execution xsequence files are downloaded. Dependingupon the implementation details, each streaming model may include only asingle initial execution xsequence file including the pages identifiedin block 1710.

In block 1710, the pages included in the initial execution xsequencefile may be identified by determining how close in time (which may bedetermined using the time stamp for the page) each page is to an originor first transition data structure listed in the list of transitions ina first state object in the directed graph structure “SD.” Then, onlythe pages accessed within a predetermined amount of time from the firsttransition data structure may be selected for inclusion in the initialexecution xsequence file(s). Alternatively, a predetermined number ofpages accessed within a least amount of time from the first transitiondata structure may be selected for inclusion in the initial executionxsequence file(s). By way of another non-limiting example, apredetermined percentage of pages including those that were accessedwithin the least amount of time from the first transition data structuremay be selected for inclusion in the initial execution xsequencefile(s).

The following pseudo code provides a non-limiting example of a method ofencoding the pages in the initial execution xsequence file using thedirected graph structure “SD.”

public void CompileInitial execution ( ) { foreach (State s inModel.states) { if (s.IsChildOf (OriginState) && s.Ticks <BUFFERTIME_THRESHOLD) { ListOfPrefectchStates.Add (s); } } }

In the pseudo code above, the function named “IsChildOf” determineswhether a second state (stored in variable named “s”) is reachable fromthe first state (stored in a variable named “OriginState”). In otherwords, the function named “IsChildOf” determines whether a path existsin the directed graph structure “SD” from the first state to the secondstate. In FIG. 6, the state “S1” is considered the first or originstate. If the second state is reachable from the first state and lessthan a threshold amount of time (stored in a constant named“BUFFERTIME_THRESHOLD”) elapsed between the first and second states, thesecond state is added to a list of initial execution states. Then, whilenot included in the pseudo code above, the pages associated with thetransitions between the first and second states are written into theinitial execution xsequence file.

In block 1715, the model building server 8 writes the pages identifiedin block 1710 to the initial execution xsequence file(s).

In block 1720, the model building server 8 identifies pages forinclusion in the sequence xsequence files. For example, in block 1720,the model building server 8 may identify the pages (identified in thepage sequence members of the transition data structures) that were notwritten to the initial execution xsequence file(s) in block 1715.

In decision block 1725, the model building server 8 decides whether tocreate a sequence xsequence file for each transition data structure thatwas not used to populate the initial execution xsequence file or toreduce the number of sequence xsequence files created by combining thetransition data structures that were not used to populate the initialexecution xsequence file. The decision in decision block 1725 is “YES”when the model building server 8 decides to combine the transition datastructures that were not used to populate the initial executionxsequence file. Otherwise, the decision in decision block 1725 is “NO”when the model building server 8 decides to create a sequence xsequencefile for each transition data structure that was not used to populatethe initial execution xsequence file.

When the decision in decision block 1725 is “YES,” in block 1730, themodel building server 8 combines at least a portion of the transitiondata structures that were not used to populate the initial executionxsequence file. For example, in block 1730, the model building server 8may combine similar transitions into a single transition to be stored ina single sequence xsequence file. By way of another example, a thresholdfile size may be used to identify sequence xsequence files having a sizeless than the threshold file size. The sequence xsequence filesidentified may be combined into one or more larger sequence xsequencefiles. The following pseudo code provides a non-limiting example of amethod of combining transitions into a single transition for storage ina single sequence xsequence file.

public void CompileSequences ( ) { foreach (State s in Model.states) {MergeSimilarSequences (s); } }

Next, in block 1735, the pages identified in block 1720 are stored insequence xsequence files. As mentioned above, a sequence xsequence filemay be created for each transition data structure that was not used topopulate the initial execution xsequence file and used to store thepages of the transition data structure for which the sequence xsequencefile was created. Optionally, the number of transition data structuresthat were not used to populate the initial execution xsequence file maybe reduced by combining two or more of them before creating the sequencexsequence files.

The sequence xsequence files store the pages that were accessed by theapplication as it executed. Thus, the sequence xsequence files store allof the pages appearing in all of the transcripts.

In block 1740, the model building server 8 identifies pages forinclusion in the rest xsequence files. In block 1740, the model buildingserver 8 identifies pages that did not appear in every transcript forinclusion in the rest xsequence files. For example, referring to FIG. 6,one or more rest xsequence files would store the pages P1 and P2.Further, in block 1740, the model building server 8 identifies pagesthat did not appear in any of the transcripts for inclusion in the restxsequence files.

While a rest xsequence file may store one or more pages also stored inone of the sequence xsequence files, this is not a requirement.Optionally, in decision block 1742, the model building server 8 maydecide whether to search the sequence xsequence files for each page andonly write pages not found in the sequence xsequence files to the restxsequence file(s). The decision in decision block 1742 is “YES” when themodel building server 8 decides to search the sequence xsequence filesfor each page. Otherwise, the decision in decision block 1742 is “NO”when the model building server 8 decides not to search the sequencexsequence files for each page.

When the decision in decision block 1742 is “NO,” in block 1744, themodel building server 8 writes the pages identified in block 1740 to therest xsequence file(s). It may be beneficial to include all of the pagesthat did not appear in every transcript in the rest xsequence file(s)because as the directed graph structure “SD” is traversed, particulartransitions may not be visited.

When the decision in decision block 1742 is “YES,” for each page, inblock 1745, the model building server 8 searches the sequence xsequencefiles to determine whether the page has been written to one or more ofthe sequence xsequence files.

Then, in decision block 1750, the model building server 8 determineswhether the page has been written to one or more of the sequencexsequence files. The decision in decision block 1750 is “YES” when thepage has been written to one or more of the sequence xsequence files.Otherwise, the decision in decision block 1750 is “NO” when the page hasnot been written to one or more of the sequence xsequence files.

When the decision in decision block 1750 is “NO,” in block 1755, themodel building server 8 writes the page to a rest xsequence file. Then,the model building server 8 advances to decision block 1760.

When the decision in decision block 1750 is “YES,” the page may beomitted from the rest xsequence file and the model building server 8advances to decision block 1760.

In decision block 1760, the model building server 8 determines whetherthere are any pages for which the sequence xsequence files have not beensearched. The decision in decision block 1760 is “YES” when the modelbuilding server 8 has not searched the sequence xsequence files for allof the pages. Otherwise, the decision in decision block 1760 is “NO”when the model building server 8 has searched the sequence xsequencefiles for all of the pages.

The pages may be ordered within the rest xsequence files based on thefrequencies at which the pages appeared in the transcripts. Restxsequence files may be downloaded when the download pipeline (that isdownloading the xsequence files from the server computing device 7 tothe client computing device 9) is idle.

The following pseudo code provides a non-limiting example of a method ofadding pages to the rest xsequence file.

public void CompileRest(Transcripts) { Transcript.Pages.SortByFrequency( ); foreach(Page p in Transcript.Pages) { RestSequence.Add (p); } }

Then, in block 1770, the model building server 8 creates the streamingmodel file 1180 (see FIG. 19). The streaming model file 1180 storesinformation in the directed graph structure “SD.” By way of anon-limiting example, the model file may store a number of states in thedirected graph structure “SD,” a list of states in the directed graphstructure “SD,” a list of transitions for each state, a weightassociated with each transition, and a list of pages associated witheach transition. The Sandbox Manager 134 may use this information topredict to which pages the virtual application 110 will request accessas the virtual application 110 executes. Based on these predictions, theSandbox Manager 134 may preemptively download pages before the pages arerequested by the virtual application 110.

Referring to FIG. 19, the following pseudo code provides a non-limitingexample of a method of creating the streaming model file 1180, and thexsequence files 1182, which in the following pseudo code include asingle initial execution xsequence file, one or more sequence xsequencefiles, and one or more rest xsequence files. The following pseudo codeuses data that was stored in data structures by pseudo code portionsprovided above.

public void Save ( ) { // save the model Model.SaveAs(“Model.xm”); //save initial execution fileListOfPrefectchStates.Squence.SaveAs(“p.xs”); // save sequencesforeach(Sequence s in States.Sequences) { // {0} represents the sequenceid s.SaveAs(“s{0}.xs”); } // save rest files foreach(Sequence s inRestSequence.SplitSequenceBy(RestPagesPerStream)) { // {0} representsthe rest sequence id s.SaveAs(“r{0}.xs”); } }

Then, the method 1700 terminates.

FIG. 7 is a block diagram of a method 1000 that may be performed by theSandbox Manager 134 and/or the Client Application 132. In first block1010, the Sandbox Manager 134 and/or the Client Application 132 requeststhat the server computing device 7 stream the virtual application 110 tothe client computing device 9. Arrow “A9” in FIG. 13 illustrates acommunication from the client computing device 9 to the server computingdevice 7 requesting that that the server computing device 7 stream avirtual application (e.g., the virtual application 110) to the clientcomputing device 9. By way of a non-limiting example, in block 1010, theSandbox Manager 134 and/or the Client Application 132 may requeststreaming by passing a URL to the server computing device 7.

In response to this request, the server computing device 7 streams thestreaming model file 1180 and the initial execution xsequence file(s)(e.g., the initial execution xsequence file 1632) to the Sandbox Manager134 and/or the Client Application 132. Arrow “A10” in FIG. 13illustrates a communication from the server computing device 7 to theclient computing device 9 that streams streaming model file 1180 and thexsequence files 1182 (which include the initial execution xsequence file1632) from the server computing device 7 to the client computing device9.

In block 1015, the Sandbox Manager 134 and/or the Client Application 132receive the model file and the initial execution xsequence file(s).

By way of a non-limiting example, the following code may be used inblocks 1010 and 1015 to pass a URL to the server computing device 7 anddownload the model file and the initial execution xsequence files.

LaunchApplication(“http://Host/StreamingApp/”);LaunchApplication(WebUrl) { Model m = DownloadModel(WebUrl +“/Model.xm”); Initial execution p = DownloadInitial execution(WebUrl +“/p.xs”); Execute(m, p); }

Then, in block 1020, the Sandbox Manager 134 launches the virtualapplication 110. Thus, the virtual application 110 begins executing eventhough less then all of the data stored in the xlayer file 300 has beendownloaded.

In decision block 1022, the Sandbox Manager 134 determines whether ithas received a notification from the virtual runtime engine 131 that apage has been requested by the virtual application 110 that has not yetbeen downloaded, or whether there are additional xsequence files to bedownloaded for the virtual application 110.

The decision in decision block 1022 is “REQUEST” when the SandboxManager 134 determines it has received a notification from the virtualruntime engine 131 that a page has been requested by the virtualapplication 110 that has not yet been downloaded.

The decision in decision block 1022 is “MORE TO DOWNLOAD” when theSandbox Manager 134 determines there are additional xsequence files tobe downloaded for the virtual application 110 and the Sandbox Manager134 determines it has not received a notification from the virtualruntime engine 131 that a page has been requested by the virtualapplication 110 that has not yet been downloaded.

When the decision in decision block 1022 is “REQUEST,” in block 1030,the directing process 129 identifies the xsequence file storing the pagefor which access has been requested. The directing process 129 may usethe model file to look up which xsequence file is storing the page forwhich access has been requested. Optionally, the directing process 129may pause execution of the virtual application 110.

In block 1035, the Sandbox Manager 134 and/or the Client Application 132download the xsequence file identified in block 1030 while the virtualapplication 110 is in use. Then, the Sandbox Manager 134 and/or theClient Application 132 advance to decision block 1065.

The Sandbox Manager 134 and/or the Client Application 132 may downloadadditional xsequence files even without receiving a notification fromthe virtual runtime engine 131 indicating a page stored by the xsequencefile has been requested. For example, after the Sandbox Manager 134and/or the Client Application 132 have downloaded the model file and theinitial execution xsequence file(s), the Sandbox Manager 134 and/or theClient Application 132 may download the sequence xsequence files.

When the decision in decision block 1022 is “MORE TO DOWNLOAD,” indecision block 1045, the Sandbox Manager 134 determines whether one ormore of the sequence xsequence files have yet to be downloaded. Thedecision in decision block 1045 is “YES” when one or more of thesequence xsequence files have yet to be downloaded. Otherwise, thedecision in decision block 1045 is “NO” when all of the sequencexsequence files have been downloaded.

When the decision in decision block 1045 is “YES,” in block 1050, theSandbox Manager 134 and/or the Client Application 132 download one ofthe sequence xsequence files. The directing process 129 may use themodel file to determine which sequence xsequence file to download.Because the directing process 129 knows which of the sequence xsequencefile was the last one downloaded, the directing process 129 may use themodel file to traverse the directed graph structure “SD” and locate thenext sequence xsequence file to download. By way of a non-limitingexample, the following pseudo code provides an exemplary download loopthat may be used to download the sequence xsequence file (referred to inthe following pseudo code as “blocks”). The function named“GetNextXferBlock( )” reads the model file to identify the next sequencexsequence file to download.

private void DoStreamDownload( ) { while (!DownloadComplete) { //prediction logic Url urlBlock = GetNextXferBlock( ); // download theblock using http Block block = DownloadBlock(urlBlock); // write thepages to memory shared // with virtual machine MemoryMap.Write(block); }}

The above download loop continues looping until all of the sequencexsequence files listed in the model file are written to the sharedmemory block 133. As mentioned above, in the above pseudo code, theorder in which the sequence xsequence files are downloaded is determinedby the function named “GetNextXferBlock( ).” The following pseudo codeprovides an exemplary implementation of the function named“GetNextXferBlock( ).”

public Block GetNextXferBlock( ) { // sort all threads and processes bylast // scheduled time to ensure fairnessVirtualApp.Threads.SortByLastScheduledTime( ); Block xferBlock = null;// get the predicted sequence foreach (VirtualThread vt inVirtualApp.Threads) { xferBlock = GetPredictedBlock(VirtualApp.Threads.First); if (xferBlock != null) {vt.LastScheduledTime = DateTime.UtcNow; return xferBlock; } } // finallyget a rest block if no other blocks // are required xferBlock =GetNextRestBlock( ); return xferBlock; }

As discussed above, the directed graph structure “SD” may include one ormore branches. Therefore, when the Sandbox Manager 134 is traversing thedirected graph structure “SD” (using the model file) and encounters abranch, the Sandbox Manager 134 must select one of the transitions ofthe branch. The Sandbox Manager 134 may perform a weighted depth firsttraversal of the directed graph structure “SD,” which reflects theorder(s) in which the pages are most commonly accessed as determined bythe profiling process 700 and the modeling process. Alternatively, othertypes of traversal, such as a breadth first traversal may be used. Theweight assigned to a transition to a particular sequence xsequence file(which stores the pages of one or more transition data structures) maybe a percentage that the particular transition occurred out of all ofthe transitions recorded in the transcripts. FIG. 8 illustrates anexemplary traversal of a streaming model containing the sequencexsequence files SXF1 to SXF6. Each transition between two consecutivelyaccessed sequence xsequence file is assigned a weight. For example, theweight assigned to the transition between the sequence xsequence fileSXF1 and SXF2 is 40%. In this example, the sequence xsequence files aredownloaded in the following order: SXF1, SXF3, SXF5, SXF6, SXF4, andSXF2.

Returning to FIG. 7, the rest xsequence files are downloaded after thesequence xsequence files have been downloaded. Thus, when the decisionin decision block 1045 is “NO,” in block 1060, the Sandbox Manager 134and/or the Client Application 132 download one or more rest xsequencefiles. The rest xsequence files are ordered by the frequency in whichtheir pages were accessed during the profiling process 700. For example,a rest file “0” (r0.xs) may contains pages that are most likely to beaccessed, and should be downloaded first. Then, the Sandbox Manager 134and/or the Client Application 132 advances to decision block 1065.

In decision block 1065, the Sandbox Manager 134 determines whether allof the xsequence files have been downloaded. The decision in decisionblock 1065 is “YES” when all of the xsequence files have beendownloaded. Otherwise, the decision in decision block 1065 is “NO” whenall of the xsequence files have not been downloaded.

When the decision in decision block 1065 is “NO,” the Sandbox Manager134 returns to decision block 1022.

When the decision in decision block 1065 is “YES,” all of the restxsequence files have been downloaded. Therefore, the applicationdownload is complete, and the method 1000 terminates.

The following pseudo code is a non-limiting example of a method ofdownloading the rest xsequence files and determining when the downloadis complete.

private Block GetNextRestBlock( ) { if (DownloadedRestBlocks <Model.RestBlocks) { return Model.RestBlocks[DownloadedRestBlocks++]; }else { DownloadedComplete = true; return null; } }

Directing Download

U.S. patent application Ser. No. 12/695,107 (which is incorporatedherein by reference) describes the Sandbox Manager 134, which is avirtual process manager configured to download and execute a virtualizedapplication file from a server computing device to a client computingdevice. Each of the streaming model file 1180 (see FIG. 19), the initialexecution xsequence files, the sequence xsequence files, and the restsequence files may be downloaded using well-known conventional downloadprotocols, such as HTTP, FTP, SMB, and the like. As discussed above, theSandbox Manager 134 may be used to implement the directing process 129configured to direct the delivery and execution of the virtualapplication 110. The directing process 129 may perform operations onbehalf of the virtual application 110 including, but not limited to,streaming application code and data, profiling execution (e.g., byperforming the method 800 illustrated in FIG. 5), managing the sandbox124, performing shell integration, and performing instance management.To support these operations in a cooperative fashion, the directingprocess 129 selectively starts, pauses, terminates, and monitors thevirtual application 110. By way of a non-limiting example, the directingprocess 129 may start, pause, resume, terminate the virtual application110 in response to a command or instruction from a user or anotherprocess (or application) separate from the Sandbox Manager 134 and thevirtual runtime engine 131. The directing process 129 may alsodynamically populate the underlying xlayer file 300 during execution ofthe virtual application 110.

FIG. 14 illustrates the block of shared memory 133 that may be used tosend settings and state between the directing process 129 and thevirtual runtime engine 131. As illustrated in FIG. 14, the directingprocess 129 may direct multiple virtual runtime engines, which may eachcommunicate with the directing process 129 via a named pipe connection(described above). Depending upon the implementation details, thedirecting process 129 may use one or more special command-line arguments1170, status events, one or more sentinel objects 1174, and sharedmemory structures 1172 (stored in the shared memory block 133) tocontrol the dynamic delivery, starting, monitoring, pausing, and/ortermination of the virtual application 110 executing with the virtualenvironment implemented by the virtual runtime engine 131.

As mentioned above, the directing process 129 may send one or morespecial command-line arguments 1170 to the virtual runtime engine 131.For example, settings may be provided to the virtual runtime engine 131via the special command-line arguments 1170. An exemplary command-lineargument may include “/XExecutionSession=<SessionId>.” This SessionIdvalue is used by the directing process 129 and the virtual runtimeengine 131 to lookup the shared memory by name.

By way of a non-limiting example, the shared memory block 133 may have aname with the following format:_xmgr_<managerVersion>_sessioninfo_<sessionId>In the above format, “managerVersion” is one of the special command-linearguments 1170 (like the SessionId value). By way of a non-limitingexample, the SessionId value may be implemented as a 64-bit integer.

Status events are created and used by the directing process 129 tosignal changes in the state of the session to the virtual runtime engine131. By way of a non-limiting example, the session may have thefollowing states, which may be assigned the exemplary values indicated:

ESessionStates { eSessionPaused = 0x1, eSessionRunning = 0x2,eSessionShutdown = 0x3, };

The sentinel object 1174, which is a named kernel object, is used toindicate the lifetime of the virtual application. For example, a namedmutex may be used. Once the sentinel object 1174 disappears (which maybe determined by polling in the directing process 129) all processes ofthe virtual application 110 have terminated. As is appreciated by thoseof ordinary skill in the art, some operating systems, such as MicrosoftWINDOWS®, are configured to track or count references by other objectsto named kernel objects. Thus, when a WINDOWS® process has a reference(or handle) to the sentinel object 1174, the host operating system 35A(see FIG. 2) will store an indication of this reference. For example,the host operating system 35A may store a reference count indicating howmany objects have references to the sentinel object 1174. When thereference count is zero, no processes have references to the sentinelobject 1174.

In addition to the above fixed-sized shared memory structures used tomanage execution of the virtual application 110, optionally, anothernamed shared memory block 1176 containing handles to a shared mapping ofthe xlayer file (e.g., the xlayer file 300) itself may be used, alongwith a shared memory based bit-array structure 1178 to support dynamicpopulation of the xlayer file (e.g., the xlayer file 300) while thevirtual application 110 is running. This is done to support streamingdelivery of the virtual application 110 using the streaming model 122.

Starting a Virtual Application

FIG. 27 is a flow diagram of a method 1200 of starting a virtualapplication in a directed fashion. The method 1200 may be performed inblock of the method 1000 illustrated in FIG. 7.

In first block 1210, the directing process 129 allocates the block ofshared memory 133 (see FIG. 2). In next block 1215, the directingprocess 129 allocates a status event object used for signaling changesin the state of the session. The status event objects may be implementedusing the WINDOWS® event system that uses kernel handles.

Then, in block 1220, the directing process 129 sets the values of anyspecific settings or values stored in the shared memory block. Forexample, the shared memory block may store a SignalEvent value and aState value. The SignalEvent value is set to the handle value of thestatus event object allocated in block 1215.

Whenever the State value is changed or the xlayer mapping 1176 isupdated by the directing process 129 (e.g., when additional xsequencefiles have been downloaded), the directing process 129 triggers aSignalEvent. In response to detecting the SignalEvent, each threadlaunched by the execution of the virtual application 110 checks theState value to determine if the state of the virtual application 110 isto be changed (e.g., paused, resumed, or terminated). Any threadswaiting for the xlayer mapping 1176 to indicate a particular portion ofthe downloading virtualized application file is available (or stored ina local copy of the virtualized application file), also check the xlayermapping 1176 to determine whether the data has been delivered.

The initial value of the State value depends upon in which state thevirtual application 110 is to be launched. If the virtual application isto be launched in a “paused” state, the State value is set to a valueindicating the application is paused (e.g., the eSessionPaused value).Otherwise, the State value is set to a value indicating the applicationis executing (e.g., the eSessionRunning value). If at some point, theapplication is terminated, the State value is set to a value indicatingthe application has shutdown (e.g., the eSessionShutdown value).

Once the shared memory block 133, status event object(s), andcommand-line arguments are prepared, in block 1225, the directingprocess 129 launches the virtual application 110. By way of anon-limiting example, the virtual application 110 may be launched viastandard a Win32 CreateProcess function or ShellExecute APIs. Thefollowing pseudo code provides a non-limiting example of a method ofstarting a virtual application.

SessionId = Allocate random 64-bit integer SharedMemoryName =“_xmgr_<mgrVersion>_sessionInfo_<SessionId>” SharedMemory =CreateSharedMemory(ReadWritePerms, SharedMemoryName) Prepare sharedmemory settings and initial state, either eSessionPaused oreSessionRunning CreateProcessArgs = “/XExecutionSession=<SessionId>”CreateProcess(VirtualAppPath, CreateProcessArgs)

The first code portion to execute within the virtual application 110 iscalled “bootstrap” code. The “bootstrap” code includes the virtualruntime engine code that, when executing, sets up the virtual runtimeenvironment, reads the configuration information (e.g., virtualfilesystem information, virtual registry settings, and the like), andother initialization tasks. As explained above, the configurationinformation may be stored in an xlayer file (e.g., the xlayer file 300).When the SessionId value is passed to the “bootstrap” code, the“bootstrap” code uses the SessionId value to determine a name of theshared memory block 133 having the predetermined format specified above,and searches for the shared memory block 133 using that name. The“bootstrap” code may also create the sentinel object 1174. Once found,addition settings can be read as well as the State value. As discussedabove, in particular implementations, the State value may be set to theeSessionPaused value, the eSessionRunning value, or the eSessionShutdownvalue.

Then, the method 1200 terminates.

Pausing and Resuming a Virtual Application

As mentioned previously, once a virtual application has been started inthe directed fashion, it is able to detect SignalEvents that providenotification of changes in the state of the session. Depending upon theimplementation details, this may be done via theWin32::WaitForMultipleObjects APIs, and by associating the SignalEventvalue with the handle of the directing process 129. After detecting aSignalEvent, the virtual application 110 can check the State value ofthe shared memory block 133. If the State value indicates the sessionhas been paused (e.g., the State value is set to the eSessionPausedvalue), the virtual runtime engine 131 blocks access by the virtualapplication 110 to the underlying xlayer file (which contains thevirtual filesystem and registry among other things). The virtual runtimeengine 131 could also explicitly suspend application threads. However,this may not be necessary.

The following pseudo code provides a non-limiting example of a method ofpausing a virtual application by setting the value of the State value tothe eSessionPaused value and triggering a SignalEvent to indicate achange in the state of the session.

SetStateInSharedMemory(SharedMemory, eSessionPaused)PulseEvent(SignalEvent)

When the State value indicates the session is running (e.g., the Statevalue is set to the eSessionRunning value), access to the xlayer file isrestored. In other words, the virtual application 110 resumes. Thefollowing pseudo code provides a non-limiting example of a method ofresuming a virtual application by setting the value of the State valueto the eSessionRunning value and triggering a SignalEvent to indicate achange in the state of the session.

SetStateInSharedMemory(SharedMemory, eSessionRunning)PulseEvent(SignalEvent)Monitoring a Virtual Application

The directing process 129 has the ability to tell the virtualapplication to shutdown. However, this shutdown occurs asynchronously.Additionally, the virtual application can shut itself down at any time,or may be shut down due to user control, for example when the usercloses the virtual application. As mentioned above, the named sentinelobject 1174 is used to determine when the virtual application iscompletely shutdown. Each process within the virtual applicationduplicates the handle of the named sentinel object 1174 to the childprocess during any create-process call. For example, the name of thenamed sentinel object 1174 may be determined as follows:_xmgr_<managerVersion>_mtx_sentinel_<sessionId>

Duplicating the handle of the named sentinel object 1174 into each childprocess ensures that the named sentinel object 1174 remains alive (e.g.,has a reference count greater than zero) for the lifetime of the virtualapplication. The directing process 129 may determine the virtualapplication is executing by polling for the existence of the namedsentinel object 1174 occasionally (e.g., at regular intervals). Forexample, the directing process 129 may poll for the named sentinelobject 1174 once every second via a Win32 timer thread function. Inembodiments in which a reference count is available, the polling maysimply poll to determine if the reference count is equal to zero meaningno objects have references (or handles) to the named sentinel object1174.

The following pseudo code provides a non-limiting example of a method ofmonitoring for virtual application shutdown.

Begin Shutdown Polling Delay For Polling Interval SentinelName =“_xmgr_<mgrVersion>_mtx_sentinel_<SessionId>” OpenMutex(SyncPermission,SentinelName) If Found Goto Begin Shutdown Polling End End

Once shutdown is detected, the directing process 129 may perform customactions, such as cleaning up resources, marking the end time in usagestatistics, recording the termination in a transcript file, etc.

Dynamic Population of XLayer File during Application Execution

To begin execution of a virtual application as soon as possible, one maytry to determine which portions of the xlayer file are necessary forinitial execution and deliver those portions to the virtual applicationfirst. To actually support dynamic population of the underlying xlayerfile while it is being executed requires a system and method for doingso.

The directing process 129 is responsible for preparing thedata-structures described above and illustrated in FIG. 15. The namedshared-memory block 133 contains handle values of the xlayer mapping1176 and the bit-array page mask 1178. The shared-memory block 133includes a file 1176 mapping of the underlying xlayer file (e.g., thexlayer file 300) with read-write access enabled. The shared-memory block133 includes a block of shared memory used to store the bit-array 1178for indicating which pages have been populated within the xlayer beingused by the virtual runtime engine 131 to execute the virtualapplication 110.

By way of a non-limiting example, the name of the shared memory block133 may have the following format:xmgr_<managerVersion>_mem_xlayerinfo_<xlayerpathhash>. Where“managerVersion” is an argument passed on the command line from thedirecting process 129. The “xlayerpathhash” may be a hash (e.g., a“good” hash) of the normalized path to the xlayer file being populated.

If the shared memory block 133 has been allocated, the virtual runtimeengine 131 concludes the xlayer file is to be dynamically delivered. Ifthe shared memory block 133 has not been allocated, the virtual runtimeengine 131 concludes the xlayer file is fully populated.

By way of a non-limiting example, the shared-memory block 133 may beimplemented using the following structure:

struct SXLayerInfo { HANDLE XLayerMapping; HANDLE PageMap; };

The following pseudo code provides a non-limiting example of a method ofpreparing dynamic xlayer population data-structures.

xlayerPathHash = GoodHash(xlayerPath) String nameSharedMemory =_xmgr_<managerVersion>_mem_xlayerinfo_<xlayerPathHash> SXLayerInfo info= CreateSharedMemory(ReadWritePerms, nameSharedMemory)info.XLayerMapping = CreateFileMapping(xlayerPath) PageMapPages =(FileSize(xlayerPath) + PAGESIZE − 1) / PAGESIZE PageMapSize =(PageMapPages + 7) / 8 into.PageMap = CreateSharedMemory(ReadWritePerms,NULL_NAME, PageMapSize)

After this data structure is prepared, execution of the application maybe started as described above. Note the local copy of the xlayer fileneed not be fully populated to launch the virtual application. However,once started, the virtual application will begin to demand access tovarious parts of the local copy of the xlayer file and will wait untilthese requests are satisfied. By way of a non-limiting example, thisaccess may be requested via an IStream interface abstraction of thexlayer file. The blocking is done by way of a check of the pageMapbit-array 1178. If a requested page is not yet populated, as indicatedby this bit-array, the virtual application waits on the SignalEvent,until the PageMap indicates the page has been populated within the localcopy of the xlayer file. The following pseudo code provides anon-limiting example of a method by which the virtual application mayaccess the xlayer file and check the PageMap.

XLayerAccess (AccessOffset, AccessBytes) PageStart = AccessOffset /PAGESIZE PageEnd = (AccessOffset + AccessBytes − 1) / PAGESIZE For Each(Page from PageStart to PageEnd) While (IsBitSetInBitArray(PageMap,Page) is FALSE) WaitForSingleObject(SignalEvent,ONE_SECOND_POLL_TIMEOUT) End End

Simultaneously, the directing process 129 may populate any portion ofthe xlayer file. The following pseudo code provides a non-limitingexample of a method by which the directing process may populate anyportion of the xlayer file.

PopulateXLayer(Data, Index) OffsetTarget = Index * PAGESIZE MappedView =MapViewOfFile(info.XLayerMapping, OffsetTarget, PAGESIZE)Memcopy(MappedView, Data, PAGESIZE) UnMapViewOfFile(MappedView)SetBitInBitArray(info.PageMap, Index) PulseEvent(SignalEvent)

As the virtual application 110 executes, it sends messages (e.g.,messages using the data structure named “SFeedbackStatsMessage”) to thedirecting process 129 indicating which page of the local copy of thexlayer file is currently being accessed by the executing virtualapplication 110. The directing process 129 uses these messages todetermine where in the streaming model file the page currently beingaccessed by the executing virtual application 110 is located. Thedirecting process 129 then begins reading the streaming model file fromthat location. This allows the traversal of the directed graph structurestored by the streaming model file 1180 to be modified by the userchoices occurring during the execution of the virtual application 110.Thus, the directing process 129 traverse the streaming model file 1180in a custom manner dictated by the actions of a user. As discussedabove, the SFeedbackStatsMessage type message includes the blockedvalue. The virtual runtime engine 131 may communicate to the directingprocess 129 that the virtual runtime engine has tried to access a pagethat has not yet been downloaded (e.g., is not indicated as beingincluded in the local copy of the downloaded xlayer file by the xlayermapping 1176) by setting the blocked value to “TRUE.”

Xsequence File Format

FIG. 16 illustrates an exemplary xsequence file format 600. The initialexecution xsequence file, sequence xsequence files, and rest xsequencefiles may each be constructed using the xsequence file format 600. Thexsequence file format 600 illustrated in FIG. 16 includes a file headerportion 610, which may be the first item of the xsequence file format,and one or more data blocks 620 (referred to as “xblocks”). Each of thexblocks 820 may store a single page. The file header portion 610includes a signature value 622, a version stamp 624, one or more flags625, a size indicator 626, an indicator of size of the original file628, an indicator of size of the xblocks 630, a number of xblocksindicator 632, and an optional number of xblocks per chapter indicator634. The data in file header portion 610 is ordered with the signaturevalue 622 being first followed by the version stamp 624, which isfollowed by the size indicator 626, which is followed by the indicatorof size of the original file 628, which is followed by the indicator ofsize of the xblocks 630, which is followed by the number of xblocksindicator 632, which is followed by the optional number of xblocks perchapter indicator 634.

The signature value 622 is a value used to authenticate the informationstored in a file. For example, the signature value 622 may be used tovalidate a particular xsequence file. By way of a non-limiting example,the signature value 622 of a valid xsequence file may store apredetermined value (e.g., the string “xsequencedfile”). Thus, tovalidate the xsequence file, the Sandbox Manager 134 may simply confirmthe signature value 622 stores the predetermined value. The signaturevalue 622 may be implemented as a 16-byte array. The value stored in thesignature value 622 may be generated using any method and the presentteachings are not limited to use with a signature value generated usingany particular method.

The version stamp 624 may include a major version identifier 636 and aminor version identifier 638. The major version identifier 636 istypically modified when a change is made to the xsequence file format600 that would make the file incompatible with a previous version of thevirtual runtime engine 131. The minor version identifier 638 may beincremented for informational purposes when the xsequence file format600 is modified such that it requires special handling to enablebackwards compatibility. By way of a non-limiting example, each of themajor and minor version identifiers 636 and 638 may be implemented as32-bit integers.

The flags 625 may include a flag that indicates whether the data storedin the xblocks 620 has been compressed. The flags 625 may include a flagthat indicates which type of compression was used to compress the datastored in the xblocks 620. By way of a non-limiting example, the flags625 may be implemented as a 32-bit integer.

The size indicator 626 identifies a location in memory that correspondsto the end of an xsequence file having the xsequence file format 600.The location in memory to which the size indicator 626 refers isidentified in FIG. 16 by a curved arrow “A6.” By way of a non-limitingexample, the size indicator 626 may be implemented as a 64-bit integer.

The indicator of size of the original file 628 indicates the size of theoriginal file (e.g., the xlayer file 300). By way of a non-limitingexample, the indicator of size of the original file 628 may beimplemented as a 64-bit integer.

The indicator of size of the xblocks 630 indicates the size of all ofthe xblocks 620 in the xsequence file combined. By way of a non-limitingexample, the indicator of size of the xblocks 630 may be implemented asa 32-bit integer.

The number of xblocks indicator 632 indicates the number of the xblocks620 in the xsequence file. By way of a non-limiting example, the numberof xblocks indicator 632 may be implemented as a 32-bit integer.

The number of xblocks per chapter indicator 634 indicates a number ofxblocks stored in a particular chapter. Chapters may be used by thedirecting process 129 of the Sandbox Manager 134 to skip to a particularportion of the xsequence file. By way of a non-limiting example, thenumber of xblocks per chapter indicator 634 may be implemented as a32-bit integer.

As mentioned above, the xsequence file format 600 includes one or morexblocks 620 that each contains a portion of the data stored in theoriginal file (e.g., the xlayer file 300). Referring to FIG. 17, each ofthe xblocks 620 has a block structure 660 that may include a signaturevalue 662, one or more flags 668, an xblock index value 670, an xblockidentifier 674, an xblock size indicator 678, and a data portion 680.The data in the block structure 660 is ordered with the signature value662 being first followed by the flags 668, which is followed by thexblock index value 670, which is followed by the xblock identifier 674,which is followed by the xblock size indicator 678, which is followed bythe number of the data portion 680.

The signature value 662 is a value used to authenticate the informationstored in an xblock and contains a unique value assigned to the xblock.The signature value 662 may be implemented as a 6-byte array. The valuestored in the signature value 662 may be generated using any method andthe present teachings are not limited to use with a signature valuegenerated by any particular method.

The flags 668 may include values for various block options. By way of anon-limiting example, the flags 668 may include an indicator that ablock stores metadata instead of virtual application data. By way of anon-limiting example, the flags 668 may be implemented as a 16-bitinteger.

The xblock index value 670 is a numeric index value assigned to thexblock within the xsequence file. This xblock index value 670 is anindex value associated with the block within an xsequence file. Forexample, if an xsequence file has four xblocks, the xblocks may beassigned index values of 0, 1, 2, and 3 in the order in which thexblocks were written to xsequence file. By way of a non-limitingexample, the index value 670 may be implemented as a 32-bit integer.

The xblock identifier 674 identifies the data stored in the xblockwithin the original file (e.g., the xlayer file 300). The model builderserver 8 divides the original xlayer file into pages. For example, anxlayer file may be divided into pages P0, P1, P2, P3, P4, . . . PN. Thexblock identifier 674 stores the location of the page in the originalxlayer file. Thus, when the xblock is read by the Sandbox Manager 134,the Sandbox Manager 134 knows where to write the xblock in the locallyreconstructed copy of the xlayer file. By way of a non-limiting example,the xblock identifier 674 may be implemented as a 32-bit integer.

The xblock size indicator 678 indicates the size of the xblock. By wayof a non-limiting example, the xblock size indicator 678 may beimplemented as a 32-bit integer.

The data portion 680 stores the data of the xblock.

As described above, the streaming model is used to create the initialexecution xsequence file, sequence xsequence files, and rest xsequencefiles in accordance with an order specified in the streaming model.After one or more of these files are downloaded, the Sandbox Manager 134may begin the process of reassembling or reconstructing the originalfile (e.g., the xlayer file 300).

Reconstructing the Original File from One or More Xsequence Files

FIG. 18 is a flow diagram of a method 900 that may be performed by theSandbox Manager 134. In particular, the method 900 may be performed bythe directing process 129 of the Sandbox Manager 134.

In first block 910, the Sandbox Manager 134 receives an xsequence file.

In next block 912, the Sandbox Manager 134 reads the information storedin the file header portion 610 (see FIG. 16) of the xsequence file.

In decision block 915 (using the information read in block 912), theSandbox Manager 134 determines whether the xsequence file received inblock 910 is valid. An xsequence file must be validated (orauthenticated) before it can be used. As mentioned above, the SandboxManager 134 may validate an xsequence file by confirming the signaturevalue 622 stores the predetermined value (e.g., the unique string“xsequencedfile”). Further, to ensure compatibility, the Sandbox Manager134 may confirm that the major and minor versions match those of thevirtual runtime engine 131.

The following pseudo code provides a non-limiting example of animplementation of blocks 912 and 915.

Method ReadXSequenceFileHeader(File) Byte[ ] signature =File.Read(GLOBAL_SIGNATURE_LENGTH) For (int i = 0; i <GLOBAL_SIGNATURE_LENGTH; i++) Begin If (signature[i] !=GLOBAL_SIGNATURE[i]) Then Throw Invalid signature exception End EndMajorVersion = File.ReadInt32( ) MinorVersion = File.ReadInt32( ) If(MajorVersion != CURRENT_MAJOR_VERSION) or  (MinorVersion !=CURRENT_MINOR_VERSION) Begin Throw Invalid version exception End Flags =File.ReadInt32( ) Size = File.ReadInt64( ) SourceFileSize =File.ReadInt64( ) BlockSize = File.ReadInt32( ) BlockCount =File.ReadInt32( ) BlocksPerChapter = File.ReadInt32( )

In the pseudo code above, if the signature value 622 (read into variable“signature”) does not equal the predetermined value (stored in theconstant “GLOBAL_SIGNATURE”), an exception is generated. Further, if themajor version identifier 636 (read into variable “Majorversion”) doesnot match the major version of the virtual runtime engine 131 (stored inthe constant “CURRENT_MAJOR_VERSION”) or the minor version identifier638 (read into variable “MinorVersion”) does not match the major versionof the virtual runtime engine 131 (stored in the constant“CURRENT_MINOR_VERSION”), an exception is generated. After the xsequencefile has been verified, in the pseudo code above, the remaining datastored in the file header portion 610 is read (e.g., the flags 625, thesize indicator 626, the indicator of size of the original file 628, theindicator of size of the xblocks 630, the number of xblocks indicator632, and the number of xblocks per chapter indicator 634). At thispoint, the Sandbox Manager 134 knows the number of blocks stored in thexsequence file (which is provided by the number of xblocks indicator632) and block sizes (which is provided by the indicator of size of thexblocks 630).

The decision in decision block 915 is “YES” when Sandbox Managerdetermines the xsequence file is valid. Otherwise, the decision indecision block 915 is “NO” when Sandbox Manager 134 determines thexsequence file is invalid. By way of a non-limiting example, thedecision in decision block 915 is “NO” when the pseudo code abovegenerates an exception because the signature value 622 does not equalthe predetermined value, the major version identifier 636 does not matchthe major version of the virtual runtime engine 131, and/or the minorversion identifier 638 does not match the minor version of the virtualruntime engine 131. Otherwise, in this example, the decision in decisionblock 915 is “YES.”

When the decision in decision block 915 is “NO,” the method 900terminates.

As mentioned above, the xsequence files are configured to be transferredfrom one computing device to another (e.g., using conventional streamingmethods). When the client computing device 9 receives an xsequence filefrom the server computing device 7, portions of the original filecontained in the received xsequence file are used to populate a copy ofthe original file constructed or assembled on the client computingdevice 9.

When the decision in decision block 915 is “YES,” in decision block 920,the Sandbox Manager 134 determines whether the xsequence file receivedis the first one for the original file. The decision in decision block920 is “YES” when the xsequence file received in block 910 is the firstone for the original file. Otherwise, the decision in decision block 920is “NO” when one or more xsequence files have been received previouslyfor the original file.

When the decision in decision block 920 is “YES,” in block 925, theSandbox Manager 134 allocates the memory mapped file 1176 illustrated inFIG. 15. The memory mapped file 1176 is not yet populated with data atthis point. Alternatively, the Sandbox Manager 134 may create the memorymapped file 1176 when the Sandbox Manager 134 receives the model file.In such embodiments, block 925 is omitted from the method 900 and whenthe decision in decision block is “YES,” the Sandbox Manager 134advances directly to block 930.

In block 930, the Sandbox Manager 134 reads the data portions 680 of thexblocks into the memory mapped file 1176 (optionally allocated in block925). As explained above, the block structure 660 includes the xblockidentifier 674 that indicates the location in the original file fromwhich the data in the xblock was obtained. The xblock identifier 674 maybe used to write the data stored in the xblock in the correct locationof the memory mapped file 1176.

The following pseudo code provides a non-limiting example of a method ofreading a single xblock into memory.

Method ReadXSequenceBlocks(File) Byte[ ] signature =File.Read(BLOCK_SIGNATURE_LENGTH) For (int i = 0; i <BLOCK_SIGNATURE_LENGTH; i++) Begin If (signature[i] !=BLOCK_SIGNATURE[i]) Then Throw Invalid block signature exception End EndFlags = File.ReadInt32( ) CurrentBlockIndex = File.ReadInt32( )CurrentBlockOriginId = File.ReadInt32( ) CurrentBlockSize =File.ReadInt32( )

Then, in block 932, the Sandbox Manager 134 sends one or notificationsthat data has been downloaded. In block 932, the Sandbox Manager maysend a notification to the virtual runtime engine 131 (e.g., thatsignals an event) that the blocks have been downloaded. The followingpseudo code provides a non-limiting example of a method of writing thedata in an xblock into the correct location of the memory mapped file1176 and sending a notification to the virtual runtime engine 131.

Method ReadXSequenceData(File, TargetStream) Byte[ ] CurrentBlockData =File.Read(CurrentBlockSize) TargetStream.Position =CurrentBlockOriginId * BlockSize TargetStream.Write(CurrentBlockData,BlockSize) NotifyBlockDownloaded(CurrentBlockIndex,CurrentBlockOriginId)

In block 932, the Sandbox Manager 134 may also modify the bit array pagemask 1178 before sending the notification to the virtual runtime engine131.

Then, in block 945, the Sandbox Manager 134 instructs the virtualruntime engine 131 to launch the virtualized application file 140 tothereby execute the virtual application 110. Depending upon theimplementation details, at this point, a initial execution xsequencefile may have been downloaded and used to initiate execution of thevirtual application 110. However, the data stored in the initialexecution xsequence file may be inadequate to support all features ofthe virtual application 110. Therefore, in decision block 950, theSandbox Manager determines whether all of the xsequence files have beendownloaded. The method 1000 illustrated in FIG. 7 and described above isused to determine the order in which the xsequence files are downloadedand to request the download of each of the xsequence files in accordancewith that order. Then, the Sandbox Manager 134 advances to decisionblock 950.

When the decision in decision block 920 is “NO,” in block 955, theSandbox Manager 134 reads the data portions 680 of the xblocks into thememory mapped file 1176 (optionally allocated in block 925). Block 955may be substantially identical to block 930.

Then in block 957, the Sandbox Manager 134 sends one or morenotifications that blocks have been downloaded. Block 957 may besubstantially identical to block 932. Then, the Sandbox Manager 134advances to decision block 950.

The decision in decision block 950 is “YES” when all of the xsequencefiles have been downloaded. The decision in decision block 950 is “NO”when all of the xsequence files have not been downloaded.

When the decision in decision block 950 is “NO,” the Sandbox Manager 134returns to block 910 whereat the Sandbox Manager 134 receives anotherxsequence file.

When the decision in decision block 950 is “YES,” in block 935, in block940, the copy of the original file (which is at least partiallypopulated) is written to the local cache 139 illustrated in FIG. 2. Thefollowing pseudo code provides a non-limiting example of a method ofcopying the copy of the original file

Method WriteXSequenceData(TargetStream, FileName) TargetStream.Position= 0 FileTarget = OpenFile(FileName) For (int i; i < TargetStream.Length;i++) FileTarget.WriteByte(TargetStream.ReadByte) End

Thus, the Sandbox Manager 134 need not wait until the entire originalfile has been assembled to instruct the virtual runtime engine 131 toexecute the virtual application 110. In other words, a partiallyassembled version of the original file may be written to the local cache139 illustrated in FIG. 2.

The copy of the original file is illustrated in FIG. 2 as thevirtualized application file 140 (e.g., a copy of the xlayer file 300)stored in the local cache 139.

Computing Devices

FIG. 28 is a diagram of hardware and an operating environment inconjunction with which implementations of the virtual application file140, the xlayer file 300, the authoring tool 170, the Sandbox Manager134, the Client Application 132, and/or virtual runtime engine 131 maybe practiced. The description of FIG. 28 is intended to provide a brief,general description of suitable computer hardware and a suitablecomputing environment in which implementations may be practiced.Although not required, implementations are described in the generalcontext of computer-executable instructions, such as program modules,being executed by a computer, such as a personal computer. Generally,program modules include routines, programs, objects, components, datastructures, etc., that perform particular tasks or implement particularabstract data types.

Moreover, those skilled in the art will appreciate that implementationsmay be practiced with other computer system configurations, includinghand-held devices, multiprocessor systems, microprocessor-based orprogrammable consumer electronics, network PCs, minicomputers, mainframecomputers, and the like. Implementations may also be practiced indistributed computing environments where tasks are performed by remoteprocessing devices that are linked through a communications network. Ina distributed computing environment, program modules may be located inboth local and remote memory storage devices.

The exemplary hardware and operating environment of FIG. 28 includes ageneral-purpose computing device in the form of a computing device 12.Each of the virtual application file 140, the xlayer file 300, theauthoring tool 170, the Sandbox Manager 134, the Client Application 132,and/or virtual runtime engine 131 may be implemented using one or morecomputing devices like the computing device 12. By way of non-limitingexample, the virtual application file 140, the xlayer file 300, theauthoring tool 170, the Sandbox Manager 134, the Client Application 132,and/or virtual runtime engine 131 may be implemented on the computingdevice 12. Further, each of the server computing device 7, the modelbuilding server 8, the client computing device 9, and the computingdevice 11 may be implemented by computing devices substantially similarto the computing device 12.

The computing device 12 includes the system memory 22, a processing unit21, and a system bus 23 that operatively couples various systemcomponents, including the system memory 22, to the processing unit 21.There may be only one or there may be more than one processing unit 21,such that the processor of computing device 12 comprises a singlecentral-processing unit (CPU), or a plurality of processing units,commonly referred to as a parallel processing environment. The computingdevice 12 may be a conventional computer, a distributed computer, or anyother type of computer.

The system bus 23 may be any of several types of bus structuresincluding a memory bus or memory controller, a peripheral bus, and alocal bus using any of a variety of bus architectures. The system memorymay also be referred to as simply the memory, and includes read onlymemory (ROM) 24 and random access memory (RAM) 25. A basic input/outputsystem (BIOS) 26, containing the basic routines that help to transferinformation between elements within the computing device 12, such asduring start-up, is stored in ROM 24. The computing device 12 furtherincludes a hard disk drive 27 for reading from and writing to a harddisk, not shown, a magnetic disk drive 28 for reading from or writing toa removable magnetic disk 29, and an optical disk drive 30 for readingfrom or writing to a removable optical disk 31 such as a CD ROM, DVD, orother optical media.

The hard disk drive 27, magnetic disk drive 28, and optical disk drive30 are connected to the system bus 23 by a hard disk drive interface 32,a magnetic disk drive interface 33, and an optical disk drive interface34, respectively. The drives and their associated computer-readablemedia provide nonvolatile storage of computer-readable instructions,data structures, program modules, and other data for the computingdevice 12. It should be appreciated by those skilled in the art that anytype of computer-readable media which can store data that is accessibleby a computer, such as magnetic cassettes, flash memory cards, USBdrives, digital video disks, Bernoulli cartridges, random accessmemories (RAMs), read only memories (ROMs), and the like, may be used inthe exemplary operating environment. As is apparent to those of ordinaryskill in the art, the hard disk drive 27 and other forms ofcomputer-readable media (e.g., the removable magnetic disk 29, theremovable optical disk 31, flash memory cards, USB drives, and the like)accessible by the processing unit 21 may be considered components of thesystem memory 22.

A number of program modules may be stored on the hard disk drive 27,magnetic disk 29, optical disk 31, ROM 24, or RAM 25, including anoperating system 35, one or more application programs 36, other programmodules 37, and program data 38. A user may enter commands andinformation into the computing device 12 through input devices such as akeyboard 40 and pointing device 42. Other input devices (not shown) mayinclude a microphone, joystick, game pad, satellite dish, scanner, orthe like. These and other input devices are often connected to theprocessing unit 21 through a serial port interface 46 that is coupled tothe system bus 23, but may be connected by other interfaces, such as aparallel port, game port, or a universal serial bus (USB). A monitor 47or other type of display device is also connected to the system bus 23via an interface, such as a video adapter 48. In addition to themonitor, computers typically include other peripheral output devices(not shown), such as speakers and printers.

The computing device 12 may operate in a networked environment usinglogical connections to one or more remote computers, such as remotecomputer 49. These logical connections are achieved by a communicationdevice coupled to or a part of the computing device 12 (as the localcomputer). Implementations are not limited to a particular type ofcommunications device. The remote computer 49 may be another computer, aserver, a router, a network PC, a client, a memory storage device, apeer device or other common network node, and typically includes many orall of the elements described above relative to the computing device 12.The remote computer 49 may be connected to a memory storage device 50.The logical connections depicted in FIG. 28 include a local-area network(LAN) 51 and a wide-area network (WAN) 52. Such networking environmentsare commonplace in offices, enterprise-wide computer networks, intranetsand the Internet.

When used in a LAN-networking environment, the computing device 12 isconnected to the local area network 51 through a network interface oradapter 53, which is one type of communications device. When used in aWAN-networking environment, the computing device 12 typically includes amodem 54, a type of communications device, or any other type ofcommunications device for establishing communications over the wide areanetwork 52, such as the Internet. The modem 54, which may be internal orexternal, is connected to the system bus 23 via the serial portinterface 46. In a networked environment, program modules depictedrelative to the personal computing device 12, or portions thereof, maybe stored in the remote computer 49 and/or the remote memory storagedevice 50. It is appreciated that the network connections shown areexemplary and other means of and communications devices for establishinga communications link between the computers may be used.

The computing device 12 and related components have been presentedherein by way of particular example and also by abstraction in order tofacilitate a high-level view of the concepts disclosed. The actualtechnical design and implementation may vary based on particularimplementation while maintaining the overall nature of the conceptsdisclosed.

Returning to FIGS. 1B and 1C, the system memory 22A and the systemmemory 22B may each be substantially similar to the system memory 22.Thus, the host operating system 35A, the host operating system 35B, thevirtual application file 140, the xlayer file 300, the authoring tool170, the Sandbox Manager 134, the Client Application 132, and/or virtualruntime engine 131 may be stored as computer executable components onthe system memory 22A and/or 22B. Each of the host operating system 35A,the host operating system 35B, the virtual application file 140, thexlayer file 300, the authoring tool 170, and/or virtual runtime enginemay be implemented using software components that are executable by theprocessing unit 21 and when executed perform the functions describedabove. Further, each of the methods 500, 505, 518, 540, 700, 800, 900,1000, 1100, and 1200 may be implemented as computer executableinstructions that are executable by the processing unit 21.

The foregoing described embodiments depict different componentscontained within, or connected with, different other components. It isto be understood that such depicted architectures are merely exemplary,and that in fact many other architectures can be implemented whichachieve the same functionality. In a conceptual sense, any arrangementof components to achieve the same functionality is effectively“associated” such that the desired functionality is achieved. Hence, anytwo components herein combined to achieve a particular functionality canbe seen as “associated with” each other such that the desiredfunctionality is achieved, irrespective of architectures or intermedialcomponents. Likewise, any two components so associated can also beviewed as being “operably connected,” or “operably coupled,” to eachother to achieve the desired functionality.

While particular embodiments of the present invention have been shownand described, it will be obvious to those skilled in the art that,based upon the teachings herein, changes and modifications may be madewithout departing from this invention and its broader aspects and,therefore, the appended claims are to encompass within their scope allsuch changes and modifications as are within the true spirit and scopeof this invention. Furthermore, it is to be understood that theinvention is solely defined by the appended claims. It will beunderstood by those within the art that, in general, terms used herein,and especially in the appended claims (e.g., bodies of the appendedclaims) are generally intended as “open” terms (e.g., the term“including” should be interpreted as “including but not limited to,” theterm “having” should be interpreted as “having at least,” the term“includes” should be interpreted as “includes but is not limited to,”etc.). It will be further understood by those within the art that if aspecific number of an introduced claim recitation is intended, such anintent will be explicitly recited in the claim, and in the absence ofsuch recitation no such intent is present. For example, as an aid tounderstanding, the following appended claims may contain usage of theintroductory phrases “at least one” and “one or more” to introduce claimrecitations. However, the use of such phrases should not be construed toimply that the introduction of a claim recitation by the indefinitearticles “a” or “an” limits any particular claim containing suchintroduced claim recitation to inventions containing only one suchrecitation, even when the same claim includes the introductory phrases“one or more” or “at least one” and indefinite articles such as “a” or“an” (e.g., “a” and/or “an” should typically be interpreted to mean “atleast one” or “one or more”); the same holds true for the use ofdefinite articles used to introduce claim recitations. In addition, evenif a specific number of an introduced claim recitation is explicitlyrecited, those skilled in the art will recognize that such recitationshould typically be interpreted to mean at least the recited number(e.g., the bare recitation of “two recitations,” without othermodifiers, typically means at least two recitations, or two or morerecitations).

Accordingly, the invention is not limited except as by the appendedclaims.

The invention claimed is:
 1. A computer-implemented method ofconstructing a plurality of downloadable files from an application fileand a transcript, the application file implementing an application andcomprising blocks of data, and the transcript storing at least one orderin which at least a portion of the blocks of data of the applicationfile were accessed by the application when the application was executedpreviously at least once, the method comprising: arranging the portionof the blocks of data in a data structure in accordance with the atleast one order in which the blocks of data were accessed, the datastructure having an origin block of data corresponding to a first blockof data accessed; identifying a first set of blocks of data in the datastructure within a predetermined distance from the origin block of data;storing the first set of blocks of data in at least one first filehaving a file name; identifying a second set of blocks of data in thedata structure beyond the predetermined distance from the origin blockof data; storing the second set of blocks of data in a first pluralityof files each having a file name; identifying a third set of blocks ofdata not in the data structure; storing the third set of blocks of datain a second plurality of files each having a file name; and storing thefile names of the first plurality of files, and the second plurality offiles in a model file.
 2. The computer-implemented method of claim 1,wherein the application file is a virtualized application file that whenexecuted, at least partially implements a virtual application.
 3. Acomputer-implemented method of constructing a plurality of downloadablefiles from an application file and a plurality of transcripts, theapplication file implementing an application and comprising blocks ofdata, the method comprising: combining a plurality of transcripts into acombined transcript, and each of the plurality of transcripts storing atleast one order in which at least a portion of the blocks of data of theapplication file were accessed by the application when the applicationwas executed previously at least once, the combined transcript storingat least one combined order comprising a combined portion of the blocksof data; arranging the combined portion of the blocks of data in a datastructure in accordance with the at least one combined order, the datastructure having an origin block of data corresponding to a first blockof data accessed in the at least one combined order; identifying a firstset of blocks of data in the data structure within a predetermineddistance from the origin block of data; storing the first set of blocksof data in at least one downloadable initial execution file; identifyinga second set of blocks of data in the data structure outside thepredetermined distance from the origin block of data; and storing thesecond set of blocks of data in a plurality of downloadable sequencefiles.
 4. The computer-implemented method of claim 3, wherein theapplication file is a virtualized application file that when executed,at least partially implements a virtual application.
 5. Thecomputer-implemented method of claim 3, wherein combining the pluralityof transcripts into the combined transcript comprises: identifying setsof like portions of the at least one orders of the plurality oftranscripts; and for each of the sets identified, combining the likeportions of the at least one orders of the plurality of transcripts inthe set into an aggregated portion, the aggregated portion comprising atransition from a first block of data of the application file to asecond block of data of the application file.
 6. Thecomputer-implemented method of claim 3, wherein the plurality ofdownloadable sequence files each have a file name, and the methodfurther comprises: identifying a third set of blocks of data not in thedata structure; storing the third set of blocks of data in a pluralityof downloadable rest files each having a file name; and storing the filenames of the plurality of downloadable sequence files and the pluralityof downloadable rest files in a downloadable model file to be downloadedwith the at least one downloadable initial execution file before theplurality of downloadable sequence files and the plurality ofdownloadable rest files are downloaded.
 7. The computer-implementedmethod of claim 6, wherein in the downloadable model file, the filenames of the plurality of downloadable sequence files are ordered inaccordance with distances of the blocks of data stored in the pluralityof downloadable sequence files from the origin block of data in the datastructure, and the file names of the plurality of downloadable restfiles are ordered in accordance with frequencies in which the blocks ofdata stored in the plurality of downloadable rest files appear in thecombined transcript.
 8. The computer-implemented method of claim 3,wherein when the application was executed previously at least once, theapplication launched a plurality of processes, and the at least oneorder stored by each of the plurality of transcripts comprises aseparate order for each of the plurality of processes.
 9. Thecomputer-implemented method of claim 3, further comprising: receiving aninstruction to construct the plurality of downloadable files from theapplication file and the plurality of transcripts; and in response tothe instruction, retrieving one or more transcripts stored on anothercomputing device before combining the transcripts into the combinedtranscript.
 10. The computer-implemented method of claim 9, furthercomprising: recording the construction of the plurality of downloadablefiles in a database, the database associating the plurality ofdownloadable files with the application and identifying a locationwhereat the plurality of downloadable files are stored.
 11. Thecomputer-implemented method of claim 3, wherein the data structure is adirected graph structure.